【发布时间】:2016-12-21 12:03:26
【问题描述】:
我有一个UITableView,每个cell 都有一张图片。当我点击cell 时,图像将被下载。我想显示活动指示器,直到图像未下载为止。
这是代码
表格视图代码
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(PicturePerformGesture:)];
[cell.oMessageImg setUserInteractionEnabled:YES];
}
PicturePerformGesture 代码
UIActivityIndicatorView *iActivity=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[iActivity startAnimating];
VideoData =[NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:videoUrl] returningResponse:nil error:nil];
[VideoData writeToFile:fullPath atomically:true];
[iActivity stopAnimating];
【问题讨论】:
-
使用 MBProgressHud github.com/jdg/MBProgressHUD
-
发布您的
TableView代码以及下载图片的位置。 -
请把代码贴在'PicturePerformGesture'方法中
-
@SerkanHekimoglu 我想将 UiActivity 指示器放在单元格上
标签: ios objective-c iphone nsdata uiactivityindicatorview