Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate a tableview with cells that link to videos
    primarykey
    data
    text
    <p>I want to create tableview cells that have a disclosure button that when pressed would link to a local video but I am having problems, when i click on the disclosure button the screen goes black, i am using arc. how can i go about this?</p> <p>here's my sample code..What am i doing wrong</p> <p>here is my header file</p> <pre><code> #import &lt;UIKit/UIKit.h&gt; #import &lt;MediaPlayer/MediaPlayer.h&gt; @interface BIDVideosViewController : UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; @property (nonatomic,strong) NSArray *tableList; @end </code></pre> <p>Here is my .m file</p> <pre><code> #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]; NSArray *array = [[NSArray 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 accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *)indexPath { NSString *thePath = [[NSBundle mainBundle] pathForResource:@"Gangan" ofType:@"mp4"]; NSLog(@"path is ...%@", thePath); NSURL *theurl = [NSURL fileURLWithPath:thePath]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl]; [moviePlayer.view setFrame:CGRectMake(0, 0, 320, 460)]; [self.view addSubview:moviePlayer.view]; [moviePlayer prepareToPlay]; [moviePlayer play]; </code></pre> <p>} </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload