【发布时间】:2017-08-09 15:32:22
【问题描述】:
我正在使用表格视图来显示下载的歌曲。我在下载歌曲之前创建空文件夹,下载歌曲后没有灭绝“.mp3”我正在用已灭绝的原始文件替换该文件。mp3 现在旨在获取文件音乐文件夹并在表格视图中对其进行拍摄。表格视图在下载歌曲之前在单元格中显示活动指示器。下载歌曲后,我通过隐藏按钮来替换活动指示器。我的问题是下载文件后它无法替换按钮但它隐藏了指示器。即使我滚动了按钮也没有出现。每当我关闭该视图控制器并返回下载列表时,它都会正确显示。下载文件后,我尝试了[tableview reload data];,但没有任何变化。
任何帮助将不胜感激
我正在使用我正在使用表格视图来显示下载的歌曲。表格视图在下载歌曲之前在单元格中显示活动指示器。下载歌曲后,我通过隐藏按钮来替换活动指示器。我的问题是下载文件后它无法替换按钮但它隐藏了指示器。即使我滚动了按钮也没有出现。每当我关闭该视图控制器并返回下载列表时,它都会正确显示。下载文件后,我尝试了[tableview reload data];,但没有任何变化。
任何帮助将不胜感激
if((![[songName substringFromIndex:MAX((int) [songName length]-4, 0)] isEqualToString:@".mp3"])
{
CoustoumCell *cellMain = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
cellMain.backgroundView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Table-view-background.png"]];
cellMain.AlbumLable.textColor = [UIColor colorWithRed:0.278 green:0.278 blue:0.278 alpha:1.0];
cellMain.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Table-view-selected-background.png"]];
cellMain.indiCatorForDon.tag=indexPath.row;
[cellMain.indiCatorForDon startAnimating];
[cellMain.playButton removeFromSuperview];
cellMain.imageView.image=Nil;
cellMain.downloadStatusLable.text=@"Downloading....";
cellMain.AlbumLable.text=[_songsList objectAtIndex:indexPath.row];
cellMain.numberLable.text=[NSString stringWithFormat:@"%d",indexPath.row+1];
}
else
{
CoustoumCell *cellMain = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
cellMain.backgroundView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Table-view-background.png"]];
cellMain.AlbumLable.textColor = [UIColor colorWithRed:0.278 green:0.278 blue:0.278 alpha:1.0];
cellMain.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Table-view-selected-background.png"]];
cellMain.AlbumLable.text=[_songsList objectAtIndex:indexPath.row];
[cellMain.indiCatorForDon stopAnimating];
cellMain.downloadStatusLable.textColor = [UIColor colorWithRed:0.278 green:0.278 blue:0.278 alpha:1.0];
cellMain.sizeLable.textColor = [UIColor colorWithRed:0.278 green:0.278 blue:0.278 alpha:1.0];
cellMain.sizeLable.text=[[self getSize] objectAtIndex:indexPath.row];
cellMain.downloadStatusLable.text=@"Downloaded";
cellMain.completedImage.image=[UIImage imageNamed:@"checked.png"];
cellMain.numberLable.text=[NSString stringWithFormat:@"%d",indexPath.row+1];
cellMain.playButton.tag=indexPath.row;
}
return cellMain;
从另一个视图下载歌曲发送通知到表格视图后
- (void) receiveTestNotification:(NSNotification *) notification
{
if ([[notification name] isEqualToString:@"TestNotification"])
{
NSLog (@"Successfully received the test notification!");
// Perform long running process
[self updateDownloadList];
[[AlbumsAnsSongs sharedManager] getallFiles];
[_tableView reloadData];
}
}
【问题讨论】:
-
请出示一些代码
-
你在使用可重复使用的细胞吗?
-
是的,我正在使用
-
@user1000 现在我用代码更新它。
-
@VenkateshSRoyal 请显示您调用的代码 [tableView reloadData];请检查答案
标签: ios objective-c