1
我正在開發一個應用程序,我必須在視圖中顯示視頻列表。我想在每行中顯示不同的視頻,就像YouTube顯示的一樣。我只添加了mediaplayerFramework。請告訴我接下來我該做什麼?任何人都可以詳細告訴我。?如何在UITableViewCell中添加視頻
這是我的.h文件
@interface videoViewController :UIViewController<UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray * arrImages;
}
,這是我的.m文件
@interface videoViewController()
@end
@implementation videoViewController
- (void)viewDidLoad {
[super viewDidLoad];
UITableView *videoTable= [[UITableView alloc]initWithFrame:CGRectMake(0, 0, Screen_width, Screen_height)];
videoTable.dataSource=self;
videoTable.delegate=self;
arrImages=[[NSMutableArray alloc]initWithObjects:@"video1",@"video2",@"video3",@"video4",@"video5",@"video6",@"video7", nil];
[self.view addSubview:videoTable];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [arrImages count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier [email protected]"CellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 100;
}
NSURL * videoURL = [NSURL URLWithString:videoURL]; 是不是? –
mpmovieplayercontroller已被棄用從iOS 9 – joey
@ joey-不要指望有人會爲你找到解決方案嗎?你爲什麼不研究一下,併爲這個問題增加另一個答案,以便它對SO成員有幫助。 – Vizllx