一个相当简短的问题,如何从视图加载后加载UIActivityIndicatorView 0.5秒?
我浏览了一下,但大多数教程都使用webview,其中创建了if语句,其中(webview.loading)用于定义动画的长度等。 所以,当视图加载0.5秒时,我只是想知道如何做到这一点。
目前,我有一种方法可以将先前选定的单元格集中在一起,我希望该指标能够持续到现在为止。
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self performSelector:@selector(scrollToRowAtIndexPath) withObject:nil afterDelay:1.0];
}
- (void)scrollToRowAtIndexPath
{
[self.tableView reloadData];
[self.tableView scrollToRowAtIndexPath:oldCheckedIndexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
}
答案 0 :(得分:2)
也许有些人会这样做:
-(void)viewDidLoad
{
[super viewDidLoad];
//... all your previous charge.
UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activity.hidesWhenStopped = YES;
activity.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleWidth;
[yourTable addSubview:activity];
[activity startAnimating];
[activity performSelector:@selector(stopAnimating) withObject:nil afterDelay:0.5];
[activity release];
}