我正在尝试在UIBubbleTableView
中创建UITableview
。我在互联网上搜索了一个例子并尝试了完全相同的事情。但是这个例子使用了xib,而我正在使用storyboard
。
我已导入项目中示例中给出的文件。但是,当我尝试运行该代码时,它会崩溃说.-
- [UITableView setBubbleDataSource:]:发送到实例的无法识别的选择器
以下是我的尝试。
@interface ChatController (){
IBOutlet UIView *textView;
IBOutlet UITextField *textF1;
NSMutableArray *bubbleData1;
IBOutlet UIBubbleTableView *bubbleTbl;
}
-(void)viewDidLoad {
[super viewDidLoad];
//bubble data
NSBubbleData *heyBubble1 = [NSBubbleData dataWithText:@"Hey, halloween is soon" date:[NSDate dateWithTimeIntervalSinceNow:-300] type:BubbleTypeSomeoneElse];
heyBubble1.avatar = [UIImage imageNamed:@"avatar1.png"];
NSBubbleData *photoBubble1 = [NSBubbleData dataWithImage:[UIImage imageNamed:@"halloween.jpg"] date:[NSDate dateWithTimeIntervalSinceNow:-290] type:BubbleTypeSomeoneElse];
photoBubble1.avatar = [UIImage imageNamed:@"avatar1.png"];
NSBubbleData *replyBubble1 = [NSBubbleData dataWithText:@"Wow.. Really cool picture out there. iPhone 5 has really nice camera, yeah?" date:[NSDate dateWithTimeIntervalSinceNow:-5] type:BubbleTypeMine];
replyBubble1.avatar = nil;
bubbleData1 = [[NSMutableArray alloc] initWithObjects:heyBubble1, photoBubble1, replyBubble1, nil];
bubbleTbl.bubbleDataSource = self;
}
该应用程序在此行崩溃。 - bubbleTbl.bubbleDataSource = self
;
我尝试连接' bubbleTbl'我tableview
的出口,但无法连接,因此我不知道如何设置bubbleDataSource
'到我的Tableview
。
任何人都可以帮助我。任何帮助表示赞赏
编辑 -
我已经实现了这个方法,并在此方法上设置了断点。但是这种方法永远不会被执行。
- (NSInteger)rowsForBubbleTable:(UIBubbleTableView *)tableView
{
NSLog(@"bubble count %lu",(unsigned long)[bubbleData1 count]);
return [bubbleData1 count];
}
编辑2 -
在泡泡中显示视频的代码 -
UIEdgeInsets insetss = { .left = 180, .right = 10, .top =10, .bottom = 200 };
NSBubbleData *videodata=[NSBubbleData dataWithView:_playerViewController.view date:[NSDate dateWithTimeIntervalSinceNow:0] type:BubbleTypeMine insets:(insetss)];
[bubbleData1 addObject:videodata];
编辑3 -
NSString *stringVideoName = @"videobuild.mov";
NSString *stringVideoPath = [[NSBundle mainBundle] pathForResource:stringVideoName ofType:nil];
NSAssert(stringVideoPath, @"Expected not nil video file");
NSURL *urlVideoFile = [NSURL fileURLWithPath:stringVideoPath];
NSAssert(urlVideoFile, @"Expected not nil video url");
_playerViewController = [[AVPlayerViewController alloc] init];
_playerViewController.player = [AVPlayer playerWithURL:urlVideoFile];
_playerViewController.view.frame = CGRectMake(10.0, 0.0, 150.0 , 80.0); // self.view.bounds;
_playerViewController.showsPlaybackControls = YES;