我无法在iTessage iPhone应用程序中滑动时在UITableView中显示时间。我启用了属性:显示水平滚动条和垂直弹跳。但它作为iMessage应用程序无法正常工作。它需要shrike UITableViewCell内容并显示时间。
- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.isOpen && self.selectIndex.section == indexPath.section)
{
NujMessage *message = [self.sectionMessages objectAtIndex:indexPath.section];
if(indexPath.row == 0)
{
int nujHeight = message.isNuj ? 15 : 0;
int cellHeight = message.size.height + kMargin + nujHeight;
if([message.moreMessages count] > 0)
{
return cellHeight > kNujMessageHeight ? cellHeight : kNujMessageHeight;
}
else
{
return cellHeight > kSectionHeaderHeight ? cellHeight : kSectionHeaderHeight ;
}
}
else{
int moreMsgCount = [message.moreMessages count];
if(indexPath.row == 1 && message.size.height <= 70)
{
message = [message.moreMessages objectAtIndex:indexPath.row - 1];
[self setMakeSizeOfMessage:message];
}
else
message = [message.moreMessages objectAtIndex:indexPath.row - 1];
int nujHeight = message.isNuj ? 15 : 0;
int cellHeight = message.size.height + kMargin + nujHeight;
if(moreMsgCount == indexPath.row )
cellHeight += 10;
else
{
nujHeight = message.isNuj ? 15 : 0;
cellHeight = message.size.height + kMargin + nujHeight;
}
return cellHeight;
}
}
else
{
NujMessage *message = [self.sectionMessages objectAtIndex:indexPath.section];
int nujHeight = message.isNuj ? 17 : 0;
int cellHeight = message.size.height + kMargin + nujHeight + 10;
if(indexPath.row == 0)
return cellHeight> kSectionHeaderHeight ? cellHeight: kSectionHeaderHeight;
else
return cellHeight;
}
return kSectionHeaderHeight ;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NujMessage *message = [self.sectionMessages objectAtIndex:indexPath.section];
if (message.opened && self.selectIndex.section == indexPath.section && indexPath.row!=0) {
static NSString *bubbleCellIdentifier = @"bubbleCell";
NujBubbleTableViewCell *bubbleTableViewCell = (NujBubbleTableViewCell*)[tableView dequeueReusableCellWithIdentifier:bubbleCellIdentifier];
if(!bubbleTableViewCell)
{
bubbleTableViewCell = [[NujBubbleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:bubbleCellIdentifier];
bubbleTableViewCell.selectionStyle = UITableViewCellEditingStyleNone;
[bubbleTableViewCell setDelegate:self];
[bubbleTableViewCell setFrame:tableView.frame];
UITapGestureRecognizer *doubleTap = [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(collapseMessages:)];
doubleTap.numberOfTapsRequired = 2;
[bubbleTableViewCell addGestureRecognizer:doubleTap];
[doubleTap release];
UILongPressGestureRecognizer *recognizerMessage = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(performActionForMessage:)];
[bubbleTableViewCell.bubbleImage addGestureRecognizer:recognizerMessage];
[recognizerMessage release];
}
[bubbleTableViewCell setSelectIndex:indexPath];
NujMessage *message = [self.sectionMessages objectAtIndex:indexPath.section];
[bubbleTableViewCell setAllowEditing:message.editing];
message = [message.moreMessages objectAtIndex:indexPath.row - 1];
[bubbleTableViewCell setShowAvatar:NO];
bubbleTableViewCell.moreMsg = NO;
[bubbleTableViewCell selectCheckButton:message.selected];
[bubbleTableViewCell setType:message.isFromMe];
NSBubbleAlign align = indexPath.section % 2 == 0 ? BubbleAlignMine : BubbleAlignSomeoneElse;
[bubbleTableViewCell setupInternalViewWithMessage:message align:align];
[bubbleTableViewCell didSelected:message.selected];
if(isEditing)
{
[bubbleTableViewCell.contentView setAlpha: message.editing ? 1.0 : 0.5];
[bubbleTableViewCell.avatarImage setAlpha: message.editing ? 1.0 : 0.5];
[bubbleTableViewCell.labelName setAlpha: message.editing ? 1.0 : 0.5];
}
else
{
[bubbleTableViewCell.contentView setAlpha:1.0];
[bubbleTableViewCell.avatarImage setAlpha:1.0 ];
[bubbleTableViewCell.labelName setAlpha:1.0];
}
return bubbleTableViewCell;
}
else
{
static NSString *bubbleCellIdentifier = @"sectionBubbleCell";
NujBubbleTableViewCell *bubbleTableViewCell = (NujBubbleTableViewCell*)[tableView dequeueReusableCellWithIdentifier:bubbleCellIdentifier];
if(!bubbleTableViewCell)
{
bubbleTableViewCell = [[NujBubbleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:bubbleCellIdentifier];
bubbleTableViewCell.selectionStyle = UITableViewCellEditingStyleNone;
[bubbleTableViewCell setDelegate:self];
UITapGestureRecognizer *doubleTap = [[ UITapGestureRecognizer alloc] initWithTarget:self action:@selector(collapseMessages:)];
doubleTap.numberOfTapsRequired = 2;
[bubbleTableViewCell addGestureRecognizer:doubleTap];
[doubleTap release];
UILongPressGestureRecognizer *recognizerMessage = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(performActionForMessage:)];
[bubbleTableViewCell.bubbleImage addGestureRecognizer:recognizerMessage];
[recognizerMessage release];
UILongPressGestureRecognizer *recognizerUser = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(performActionForUser:)];
[bubbleTableViewCell.avatarImage setUserInteractionEnabled:YES];
[bubbleTableViewCell.avatarImage addGestureRecognizer:recognizerUser];
[recognizerUser release];
}
[bubbleTableViewCell setSelectIndex:indexPath];
NujMessage *message = [self.sectionMessages objectAtIndex:indexPath.section];
bubbleTableViewCell.moreMsg = message.moreMessagesCount > 0 && !message.opened;
[bubbleTableViewCell setShowAvatar:YES];
[bubbleTableViewCell setAllowEditing:message.editing];
[bubbleTableViewCell selectCheckButton:message.selected];
[bubbleTableViewCell setName:message.buddy.displayName];
[bubbleTableViewCell setType:message.isFromMe];
[bubbleTableViewCell setupInternalViewWithMessage:message
align:indexPath.section % 2 == 0 ? BubbleAlignMine : BubbleAlignSomeoneElse
];
[bubbleTableViewCell didSelected:message.selected];
[bubbleTableViewCell hideCheckButton:message.editing];
if(isEditing)
{
[bubbleTableViewCell.contentView setAlpha: message.editing ? 1.0 : 0.5];
[bubbleTableViewCell.avatarImage setAlpha: message.editing ? 1.0 : 0.5];
[bubbleTableViewCell.labelName setAlpha: message.editing ? 1.0 : 0.5];
}
else
{
[bubbleTableViewCell.contentView setAlpha:1.0];
[bubbleTableViewCell.avatarImage setAlpha:1.0 ];
[bubbleTableViewCell.labelName setAlpha:1.0];
}
return bubbleTableViewCell;
}
}
关心 瓦代夫卢