Sorry if it is asked somewhere, but as a beginner, I need a very specific answer for my question. Where is wrong, correction and suggestions.
I write those under application didFinishLaunchingWithOption:
UIColor *myBackgroundColor = [[UIColor alloc]initWithRed:.87 green:.77 blue:.56 alpha:.99];
[window setBackgroundColor:myBackgroundColor];
It worked, and change the color of the background, and then I try to separate those two messages.
UIColor *myBackgroundColor = [UIColor alloc];
[myBackgroundColor initWithRed:.87 green:.77 blue:.56 alpha:.99]
[window setBackgroundColor:myBackgroundColor];
How should I code to make it run correctly? I will need both reason and corrections. Thanks a lot.
You can’t assume that
allocandinithas the same return value.The following should work:
I don’t understand why you’d want to add the extra line though.