2017-10-11 21 views
-1

Im not sure why it will nit let me bring in the blue color have looked for multiple resources before posting here and why it is saying the UIView "has no member"過時Udacity當然,這是3歲,現在將不能識別顏色

努力學習的Xcode上迅速4 3歲多的視頻被證明是比我想象的更困難。

+1

查找至少使用Swift 3的教程。使用Swift 2代碼的教程在嘗試學習Swift 3或4時將是一個巨大的負擔。Swift 2到Swift 3是一個巨大的變化。幾乎一切都在變化。 Swift 3到Swift 4幾乎沒有變化。 – rmaddy

+0

什麼樣的類是'self.view.addSubView()'調用的?它是一個UIView? – jlafay

回答

0

你有兩個問題。首先是顏色的正確參考。我可以幫忙。 UIColor有一個返回的藍色,應在地方的blue()使用方法:

UIColor.blue() 

至於你的第二個錯誤去,我不知道什麼樣的類的你是從,但它調用addSubView()可能只是第一個錯誤的症狀。如果我的建議更改無效,請提供一些其他信息,我很樂意爲您提供幫助。

+1

我很欣賞它,我在等待時看到幾個快速4個視頻,發現解決方案是button.setTitleColor(UIColor.blue,用於:.normal) self.view.addSubview(button) –