对不起,如果它已经被问过,但来这里的问题:[的UIImageView的setText:]:无法识别的选择发送到实例
我得到这个消息时,我滚动快的tableView:
终止应用程序由于未捕获的异常 'NSInvalidArgumentException',原因是: ' - [的UIImageView的setText:]:无法识别的选择发送到实例0x8a8f8d0'
这里是我的代码:
NewsVideoCell *cell = [tableView dequeueReusableCellWithIdentifier:AudioCellIdentifier];
if (cell == nil) {
cell = [[NewsVideoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:AudioCellIdentifier];
}
cell.backgroundView = [ [UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"news_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0)] ];
cell.selectedBackgroundView = [ [UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"news_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0)] ];
UILabel *cellLabel = (UILabel *)[cell viewWithTag:1];
[cellLabel setText:[masjid objectForKey:@"name"]];
UILabel *cellDate = (UILabel *)[cell viewWithTag:2];
[cellDate setText:[[news objectAtIndex:indexPath.row] objectForKey:@"date"]];
UIImageView *cellImage = (UIImageView *)[cell viewWithTag:3];
NSString *imagePath = [masjid objectForKey:@"thumb"];
[cellImage setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@", imagePath]]];
UITextView *cellText = (UITextView *)[cell viewWithTag:5];
NSString *postText = [[news objectAtIndex:indexPath.row] objectForKey:@"title"];
[cellText setText:postText];
...
并触发此异常的行是:
[cellText setText:postText];
我看到这是由于过度保留或正在释放,但我没有找到一个方法来解决它。
任何帮助PLZ?
它看起来像标记视图#5是图像视图,而不是文本视图。这可能吗? – dasblinkenlight 2012-07-28 03:37:03
当您将视图分配给标签或textview时,请尝试使用cell.contentView代替单元格 – 2012-07-28 05:21:09
@dasblinkenlight否,带标签的视图#5是文本视图而不是图像视图。这就是为什么我不明白为什么它告诉我[UIImageView setText:]:无法识别的选择器 – Abdessamad 2012-07-28 11:30:54