开发者

A number box (jump from 0 to 9) in the view in iPhone . How should I do? [closed]

开发者 https://www.devze.com 2023-03-27 04:24 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center开发者_运维问答. Closed 11 years ago.

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
0

精彩评论

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

关注公众号