开发者

how to make it so when a view loads, it does something?

开发者 https://www.devze.com 2023-02-10 06:02 出处:网络
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 b

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号