【发布时间】:2011-05-20 06:52:18
【问题描述】:
i was trying to animate the UIActivityindicator at didSelectRowAtIndexPath i.e when row is selected it should start animating until other view is not loaded.我正在尝试代码,但它什么也没做,求助!!!
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self. indicator stopAnimating];
if(bdvController == nil)
bdvController = [[BookDetailViewController alloc] initWithNibName:@"BookDetailView" bundle:[NSBundle mainBundle]];
if(indexPath.section == 0)
{
Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];
bdvController.aBook = aBook;
}
else if(indexPath.section == 1)
{
Book *aBook = [appDelegate.books objectAtIndex:indexPath.row+5*indexPath.section];
bdvController.aBook = aBook;
}
[self.navigationController pushViewController:bdvController animated:YES];
}
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.indicator startAnimating];
return indexPath;
}
【问题讨论】:
-
我觉得这个
[self.indicator.startAnimating];应该是[self.indicator startAnimating];。 -
@Nick:是的,我看到了……这是我的错误。它应该像你推荐的那样。
标签: iphone