【发布时间】:2015-05-16 06:18:38
【问题描述】:
我正在开发一个应用程序,我必须在表格视图中显示视频列表。我想在每一行显示不同的视频,就像 youtube 节目一样。我只添加了 mediaplayerFramework。请告诉我接下来我要做什么?谁能详细告诉我?
这是我的 .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 =@"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;
}
【问题讨论】:
标签: ios uitableview video tablerow