我轉我的項目到iOS的10和8的XCode新的測試版本在我的應用程序的所有三個領域,我使用display:clipsToBounds導致的UIImage不要在iOS10和XCode的8
imageView.layer.cornerRadius = imageView.frame.size.width/2
imageView.clipsToBounds = true
相關的圖像根本不顯示。我試圖清理項目以及構建文件夾,重新啓動設備,嘗試各種模擬器,重新添加imageView,以編程方式設置關聯的UIImage
而不是從資產中選擇一個。
刪除clipsToBounds
線顯示矩形圖像,不管masksToBounds
是true
還是false
。如何在XCode8/iOS10中製作圓形圖像?
編輯:項目是Swift 2.x,但尚未更新爲Swift 3.0語法。
所以它刪除了clipsToBounds設置語句,並在cornerRadius停止影響再次成爲直角的ImageView和你的形象? – ddb
@ddb是的,刪除clipsToBounds語句後,圖像是矩形的並且是可見的。 – cloudcal
這樣的回答:http://stackoverflow.com/questions/39380128/ios-10-gm-with-xcode-8-gm-causes-views-to-disappear-due-to-roundedcorners建議呼籲self.layoutIfNeeded –