A number box (jump from 0 to 9) in the view in iPhone . How should I do? [closed]
I mean I have a UIImageView
, and I want to put a number on it. And then the number jumps from 0 to 9.
I guess (you should definitely explain in more detail what you want to do) you want to display a number that is changing over time.
Suppose you have an UILabel which displays the number:
@interface MyViewController : UIViewController {
UILabel *myNumberLabel;
}
@end
@implementation MyViewController
- (id)init {
if ((self = [super init])) {
myNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0,50,50)]; //or some other rect..
[self.view addSubView:myNumberLabel];
}
return self;
}
- (void)dealloc {
[myNumberLabel release];
[super dealloc];
}
- (void)updateNumber:(NSNumber*)number {
[myNumberLabel setText:[number stringValue]];
}
@end
精彩评论