我正在構建一篇文章閱讀應用程序。我正在使用AMSliderMenu(https://github.com/SocialObjects-Software/AMSlideMenu) 庫的菜單列表。如何在執行segue期間UIActivityIndicatorView?
我無法實施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 https://github.com/jdg/MBProgressHUD。 – kelin 2014-09-04 13:16:56
爲什麼不使用MBProgressHUD?其中最好的 – sreekanthk 2014-09-04 13:27:42