對不起,如果它被問到某處,但作爲初學者,我需要一個非常具體的答案爲我的問題。錯在哪裏,更正和建議。我試圖分開alloc和initWithRed ...消息,但它似乎不工作
我寫那些正在申請didFinishLaunchingWithOption:
UIColor *myBackgroundColor = [[UIColor alloc]initWithRed:.87 green:.77 blue:.56 alpha:.99];
[window setBackgroundColor:myBackgroundColor];
它的工作,並更改背景顏色,然後我嘗試這兩個信息中分離出來。
UIColor *myBackgroundColor = [UIColor alloc];
[myBackgroundColor initWithRed:.87 green:.77 blue:.56 alpha:.99]
[window setBackgroundColor:myBackgroundColor];
我該如何編碼才能使其正確運行?我將需要理由和更正。非常感謝。
更多的問題。如果我需要寫「myBackgroundColor = [myBackgroundColor initWithRed:.87 green:.77 blue:.56 alpha:.99]」爲什麼會「[myUIView initWithFrame:myCGRect];」工作好嗎? – 2011-06-09 15:07:13
如果您還有其他問題,應該將其作爲新問題而不是評論。 – 2011-06-09 15:19:32