【发布时间】:2025-12-26 07:25:11
【问题描述】:
我正在构建一个文章阅读应用程序。我正在使用 AMSliderMenu(https://github.com/SocialObjects-Software/AMSlideMenu) 菜单列表库。
我无法实现UIActivityIndicator,当我点击AMSlideMenu中的表格单元格时,加载另一个视图需要时间,因为数据已加载到另一个视图中。
当用户单击单元格UIActivityIndicator 时,我想给UIActivityIndicator 执行直到它打开另一个视图。
这是我的代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.center = CGPointMake(160, 240);
spinner.hidesWhenStopped = YES;
[self.view addSubview:spinner];
[spinner startAnimating];
dispatch_queue_t downloadQueue = dispatch_queue_create("downloader", NULL);
dispatch_async(downloadQueue, ^{
[NSThread sleepForTimeInterval:10];
dispatch_async(dispatch_get_main_queue(), ^{
[spinner stopAnimating];
});
});
NSString *segueIdentifier = [self.mainVC segueIdentifierForIndexPathInLeftMenu:indexPath];
if (segueIdentifier && segueIdentifier.length > 0)
{
[self performSegueWithIdentifier:segueIdentifier sender:self];
}
}
【问题讨论】:
-
按下一个单元格会发生什么?顺便说一句,考虑 MBProgressHud github.com/jdg/MBProgressHUD。
-
你为什么不使用 MBProgressHUD?它是最好的之一
标签: ios objective-c uiactivityindicatorview didselectrowatindexpath