开发者

Refresh iPhone For progressbar

How would i show that the progress bar is working there is no Refresh() in objective-c like there is in .net what would i use

for example

contactprogress.progress = 0.5;   
StatusLabel.text = @"Status: Address Found";

How would i refresh the view to show that the pr开发者_JAVA技巧ogress has changed & show user the StatusLabel status?

Thanks

Mason


Based on your comments to the other two responses, you're doing some computationally intensive task that takes a few seconds, and the view is not updating during the task. You could try using two threads (not as scary as it sounds) so that the UI can continue updating while the task is doing its thing.

Here is an example.

iOS Reference Library Threading Programming Guide


It sounds like you want to update a progress bar and some text repeatedly with some time interval between. You could use a simple timer. Read about timers here. Perhaps something like this:

[NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(refreshProgress) userInfo:nil repeats:YES];

and:

- (void) refreshProgress:(id)sender {
  // figure out new progress bar and text values
  contactprogress.progress = 0.5;   
  StatusLabel.text = @"Status: Address Found";

  // check if we should stop the timer and hide the progress bar/status text
}

That would update your progress bar with new values every 0.1 seconds.


To redraw an UIView, you can use

[UIView setNeedsDisplay];

However, you will need this only in very rare cases. When you change, let's say the contents of a label, your UI should update instantly. You might want to provide more code/context for your problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜