嗨,我使用code來創建聊天視圖其工作正常,但我需要在點擊添加放大圖像,所以在UIBubbleTableView.m類我添加以下代碼來獲取索引選定的值。UIBubbleTableView從NSBubbleData中獲取didSelectRowAtIndexPath?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"value of index=%@",[NSString stringWithFormat:@"%d",indexPath.row]);
NSLog(@"value of selected section=%@",[NSString stringWithFormat:@"%@", [[self.bubbleSection objectAtIndex:indexPath.section] objectAtIndex:indexPath.row - 1]]);
}
它給出以下輸出:選擇部的
值=
如何從獲得上述NSBubbleData文本或圖像?
在該代碼中的數據通有如下格式
//for photo
NSBubbleData *photoBubblenew = [NSBubbleData dataWithImage:image date:[NSDate dateWithTimeIntervalSinceNow:-0] type:BubbleTypeMine];
//for text
NSBubbleData * TextBubble = [NSBubbleData dataWithText:@"Hi,Check out Iphonelover" date:[NSDate dateWithTimeIntervalSinceNow:-300] type:BubbleTypeSomeoneElse];
這是不完全清楚你正在嘗試做的事情 - 假設self.bubbleSection是一個數組的NSBubbleData數組,並假設你從這裏使用NSBubbleData https://github.com/AlexBarinov/UIBubbleTableView/blob/master/src/NSBubbleData.h然後它公開一個UIView,而不是一個字符串 – Paulw11
嘿保羅,我怎麼能得到該視圖的價值和猜測它包含文本或圖像? 我需要做的是:如果它包含圖像,然後放大它,如果它包含文本,然後提供翻譯等功能 – iphonemaclover
'view'屬性包含對'UIView'的引用。 – Paulw11