Я ищу, чтобы создать страницу контроллера таблиц формата списка воспроизведения, в которой есть видео в ячейках. Когда нажата кнопка раскрытия, воспроизводится видео и т. Д. Любые идеи о том, как это сделать? .. Или ссылка на хороший учебник по этому поводу? я растрескивание голову на this..spending так много времени в Интернет без толка .. любой помощи будет оценена и проголосовала благодаряTablecell с видеодисплеем
вот мой образец code..i знает, это, возможно, не быть лучший способ пойти об этом, следовательно, он не работает работает
здесь мой файл заголовка
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface BIDVideosViewController : UIViewController
<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic,strong) NSArray *tableList;
@end
Вот мой файл .m
#import "BIDVideosViewController.h"
@interface BIDVideosViewController()
{
MPMoviePlayerController *moviePlayer;
}
@end
@implementation BIDVideosViewController
@synthesize tableList;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UITableView *table = [[UITableView alloc]initWithFrame:self.view.bounds];
[table setDelegate:self];
[table setDataSource:self];
[self.view addSubview:table];
tableList = [[NSMutableArray alloc] initWithObjects:@"Gangan",@"SwimGood", nil];
self.tableList = array;
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tableList count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *DisclosureButtonIdentifier = @"DisclosurebutotonIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DisclosureButtonIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DisclosureButtonIdentifier];
}
NSInteger row = [indexPath row];
NSString *rowString = [tableList objectAtIndex:row];
cell.textLabel.text = rowString;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *stringPath = [[NSBundle mainBundle]pathForResource:@"Gangan" ofType:@"mp4"];
NSURL *url = [NSURL fileURLWithPath:stringPath];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerScalingModeDidChangeNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(endPlay:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(stopBusyIndicator:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:moviePlayer];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
moviePlayer.movieControlMode = MPMovieControlModeDefault; //'movieControlMode' is deprecated
//moviePlayer.backgroundColor = [UIColor blackColor];
moviePlayer.view.frame = CGRectMake(212, 84, 600, 600);
[self.view addSubview:moviePlayer.view];
[moviePlayer play]; </i>
Вы хотите воспроизвести видео внутри ячейки или в другом контроллере после нажатия кнопки раскрытия? – Deepak
Я хочу воспроизвести видео после нажатия кнопки раскрытия, точно так же, как будет работать youtube @Deepak – DanKiiing
Oh! поэтому вы можете перейти на MPMoviePlayerController. – Deepak