且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在UITableView下添加活动指示器?

更新时间:2023-12-05 17:02:58

添加活动指标的***方法是在tableview的页脚。

The best way to add activity indicator is at footer of tableview.

    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 
UIView *headerView = [[[UIView alloc] init]autorelease];

    [headerView setBackgroundColor:[UIColor clearColor]];

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self 
           action:@selector(aMethod:)
 forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Load More" forState:UIControlStateNormal];
button.frame = CGRectMake(10.0, 210.0, 160.0, 40.0);


    [headerView addSubview:button];

    [headerLabel release];

    return headerView;

}  

向页脚视图添加按钮并将操作设置为按钮(如你所知)。这个应用商店tableview如何工作。单击按钮获取更多数据添加到表数组滚动表没有动画。

Add a button to the footerView and set action to button (as you needed). This how app store tableview works. On clicking button fetch some more data add to table array scroll the table without animation.