开发者

iPhone SDK reload UIView's content

开发者 https://www.devze.com 2022-12-23 06:59 出处:网络
I have two views, one view takes the whole screen, the second view covers onl开发者_如何学运维y a little portion.What I want is for that second view to be on the first view (which I already have done)

I have two views, one view takes the whole screen, the second view covers onl开发者_如何学运维y a little portion. What I want is for that second view to be on the first view (which I already have done), but the problem is, when I set values (in this case UILabel's) the label on the screen doesn't display that new value. I know for a fact the method gets called, but for some reason it won't change the label's value.

Edit: Here's the code:

-(void)loadHighScores
{   
[no1 setText:@"test"];
 NSLog(@"it works");
}

And here's how I call it:

    highscore = [[HighScore alloc] init];
    [highscore loadHighScores];


Have you tried:

[myView setNeedsDisplay];

Quote from Apple docs:

By default, geometry changes to a view automatically redisplays the view without needing to invoke the drawRect: method. Therefore, you need to request that a view redraw only when the data or state used for drawing a view changes. In this case, send the view the setNeedsDisplay message. Any UIView objects marked as needing display are automatically redisplayed when the application returns to the run loop.

0

精彩评论

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