Я разрабатываю приложение, в котором мне нужно показать список видео в виде таблицы. Я хочу показывать разные видеоролики в каждой строке, как показано на 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