I am trying to add button on MPMoviePlayerViewController's navigationcontroller.view. I have wrote following so far. It doesn't give any error but button isn't appearing on view! Could anyone please tell me what am I doing wrong? Thanks.
MPMoviePlayerViewController *videoController = [[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:filePath]] autorelease];
UIButton *favButton = [UIButton buttonWithType:UIButtonTypeCustom];
favButton.frame = CGRectMake(280, 25, 30, 30);
[favButton addTarget:self action:@selector(favouriteButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
[favButton setBackgroundImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
[videoController.navigationController.view addSubview:favButton];
[self presentMoviePlayerViewControllerAnimated:videoController];
- (void)favouriteButtonClicked:(id)sender
{
NSLog(@"Inside favourite button clicked");
}
Also try adding using following code but no luck!
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(favouriteButtonClicked:)];
videoController.navigationController.navigationItem.rightBarButtonItem=button;
[button release];