how to make it so when a view loads, it does something?
I am making a quiz app, and I wanted it to have a saying at the end of the quiz. This saying is supposed to change based on an NSInteger (myScore). How would I code thi开发者_JS百科s? Any help would be helpful to me. Thanks!
You are going to create a UILabel based on an NSInteger:
NSInteger yourInteger;
UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100);
[aLabel setText:@"Score %d", yourInteger];
[aLabel setBackgroundcolor:[UIColor clearColor]];
[aLabel setOpaque:NO];
[[self view] addSubview:aLabel];
actually %d is replaced with your integer
精彩评论