現在表示されていないが以前にロードされた別のTableViewControllerのtableViewにUITableViewCellを追加している奇妙な問題が発生しています。 問題は、セルがのtableViewに追加されますが、私はそのビューコントローラに移動後、セルの内容が空白であるということである。UITableViewCellの内容他のView Controllerからセルが追加されたときに表示されない
セルcontentViewのtableViewのCellForRowAtIndexPathは見えないまで表示されます。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
LYRConversation *conversation = [_dataSource objectAtIndex:indexPath.row];
ConversationListCell *cell = (ConversationListCell *)[tableView dequeueReusableCellWithIdentifier:CELL_REUSE_ID forIndexPath:indexPath];
[self configureCell:cell atIndexPath:indexPath conversation:conversation];
return cell;
}
-(void)configureCell:(ConversationListCell *)conversationCell atIndexPath:(NSIndexPath *)indexPath conversation:(LYRConversation *)conversation
{
[conversationCell updateAvatarWithUrl:[NSURL URLWithString:[self avatarStringUrlForConversation:conversation]]];
[conversationCell updateTitle:[self titleForConversation:conversation]];
[conversationCell updateUnreadMessageIndicator:conversation];
NSArray *otherParticipants = [[PersistentCache sharedCache] cachedUsersForUserIDs:conversation.participants];
conversationCell.preview.text = [((PFUser *)otherParticipants.lastObject) objectForKey:@"jobTitle"];
[UIView updateStatusIndicatorOfConversation:otherParticipants statusIndicator:conversationCell.status];
}
-(void)updateAvatarWithUrl:(NSURL *)avatarUrl
{
if (avatarUrl != nil) {
downloadImageThenSetForImageView(self.avatar, avatarUrl);
}
}
-(void)updateTitle:(NSString *)title
{
self.title.text = title;
}
-(void)updateUnreadMessageIndicator:(LYRConversation *)conversation
{
if (conversation.lastMessage.isUnread) {
[_unreadMessageIndicator setImage:[ConversationListCell unreadBlue]];
}
else {
[_unreadMessageIndicator setImage:[ConversationListCell unreadGray]];
}
}
+(void)updateStatusIndicatorOfConversation:(NSArray<PFUser *> *)users statusIndicator:(UIView *)view
{
int statusValue = ((NSNumber *)[users.firstObject objectForKey:@"status"]).intValue;
if (statusValue == 1) {
view.backgroundColor = [UIColor PNGInOffice];
}
else if(statusValue == 2){
view.backgroundColor = [UIColor PNGBusy];
}
else if(statusValue == 3){
view.backgroundColor = [UIColor PNGAway];
}
}
このビューコントローラは、ストーリーボードの自動レイアウトを使用してレイアウトされています。ありがとうございました!
私はそれを試みましたが、それでもまだ空白が表示されます – Midas