iPhone - iOS4 - Movie Player - Fullscreen does not work - ios4

I have implemented MPMoviePlayer functionality to play in landscape mode in iOS4- by reading information on other posts - thanks stackoverflow!
Basically I have a list of videos in tabular view and from that I can navigate to each video.
Problem I am facing is the video does play in fullscreen (landscape) however the top title bar and bottom navigation bars continue to be visible above the movie. I have tried to hide the bottom tabbar
[self.navigationController setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:MstvideoplayerView animated:YES];
as well as tried to bring the movie subview to front
[[mpMoviePlayerControllerObj view] setFrame:CGRectMake(0, 0, 480, 320)];
[[self view] bringSubviewToFront:[mpMoviePlayerControllerObj view]];
mpMoviePlayerControllerObj.controlStyle = MPMovieControlStyleFullscreen;
However the top title bar (from movie list view) and bottom navigation bar still remain - on top of the movie player window.
How do I hide/get rid of these 2?

If you call the UIViewControllers method
presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animatedwith the MPMoviePlayerViewControllerinstance, it should present the movie player fullscreen

Related

Changing StatusBar orientation has no effect

I have two ViewControllers - the main one is Portrait only - the second, which displays a WebView loaded with a YouTube video can rotate to any orientation. When it is dismissed in Landscape, returning to the main ViewController, the status bar is left in Landscape mode. I know when the YouTube view is dismissed and have placed the following line on code in the called method:
UIApplication.SharedApplication.SetStatusBarOrientation(UIInterfaceOrientation.Portrait,true);
But it has no effect on the status bar. Is there some other place to set the orientation? Other ideas?
Thanks,
Rick
Fixed the problem by adding the following to the AppDelegate
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations (UIApplication application, UIWindow forWindow)
{
return UIInterfaceOrientationMask.AllButUpsideDown;
}
Then this code actually did what it is supposed to:
UIApplication.SharedApplication.SetStatusBarOrientation(UIInterfaceOrientation.Portrait,true);

Why no back button on DateElement picker?

This walkthrough for MT.D shows a back button on the UIDatePicker that appears when a DateElement is tapped. I'm in an iPad app, and using an MT.D DialogViewController as a subview in an overall UIView. When the date picker slides up I just get the black background with no way to dismiss the picker (no nav bar w/ back button). Same problem exists for the radio group picker. Is this because the dialog view controller is being used as a subview? Any ideas how I might get a nav bar up with a back button using the built-in picker logic?
You must use the DialogViewController as a child element of a UINavigationController to get the back button. On iPad, you can embed the UINavigationController in a UIPopoverController.
Adding the view of a controller into the view of another controller is not considered good design on iOS and won't result in the behavior you expect.

BackButtonBarItem not working properly in iphone

I implemented the following code to show the navigation bar with a backbuttonbaritem.
[mapNavigationItem setTitle:#"Tracking"];
[mapNavigationItem setRightBarButtonItem:nil];
[mapNavigationItem setLeftBarButtonItem:nil];
UIBarButtonItem *stopTrackingBarButton = [[UIBarButtonItem alloc] initWithTitle:#"Stop Tracking" style:UIBarButtonItemStylePlain target:nil action:#selector(stopTracking)];
[mapNavigationItem setBackBarButtonItem:stopTrackingBarButton];
[mapNavigationBar pushNavigationItem:mapNavigationItem animated:NO];
[stopTrackingBarButton release];
The stopTracking button is displayed on the screen, but no title is displayed. When i click on the stopTracking button, it disappears and then shows the title.
Could someone please tell me whats happening??
Ok i think i wasnt clear enough,
I have a mapview with buttons in the tab bar, when the app starts the navigation bar shows 2 buttons, when i click on one of the Tab bar items, it should clear the navigation bar buttons and add a back button bar button item only. I am successful upto this stage.
But when i click on the BackBar button item, it disappears, and does not perform the action assigned to it.
FYI:
IBOutlet UINavigationBar *mapNavigationBar;
IBOutlet UINavigationItem *mapNavigationItem;
If you want to use a different title for your back button than the previous navigation title, then you need to change it just before pushing the new view controller and change it back again after popping it.
So something like:
self.navigationItem.title = #"Stop Tracking";
[self.navigationController pushViewController:mapNavigationItem animated:NO];
and in this class's viewWillAppear
self.navigationItem.title = #"Tracking";
Edit:
If you are not using the backbarbutton for taking the navigation controller back then dont set it as a backBarButton simply set it as left barButton item.
Plus it also seems like you are using same navigation bar for both tabs. not a good idea. Load both tab views from different viewcontrollers and add two different navigation bars to those views.

iphone - how to refresh a uiview with a scrollview?

any advice welcome! :)
My screen design is landscape with text on the left (this is in the main view) and a scrollview on the right (which contains an interactive map image)
The mainviewcontroller contains the scrollview as an outlet.
In the scrollviewcontroller I add a 'map' view into the scrollview.
In the mapviewcontroller I update an array in the appdelegate, depending on the user input.
I would now like to refresh the main uiview that contains the scrollview to display the updated text from the appdel array - whenever the user clicks a button.
You should call your view's -(void)setNeedsDisplay method to cause it to redraw.
[myView setNeedsDisplay];
See Apple's reference documentation here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html%23//apple_ref/doc/uid/TP40006816-CH3-BBCCADHC
You have to call viewWillAppear from the other viewcontroller

MPMoviePlayerController view vanishes on Presenting a modal View Controller

My view hierarchy containing the view from a MPMoviePlayerController vanishes the moment I present a Modal View Controller.
Instead of displaying a view with a movie and controls it depicts an earlier subview beneath it. I checked the subview array of the main view controller and all views including the movie player view exits.
Forcibly adding the movie player view after the modal view controller is done does not bring movie player view back on top.
Would welcome any suggestions/thoughts ?
your problem isn't specific to the MPMoviePlayerController. any time you present a modal view controller, all of the views from other view controllers beneath it disappear.
try it out with just a couple of simple view controllers.
in the app delegate, set your window background color to red:
[self.window setBackgroundColor:[UIColor redColor]];
then add a view controller with a green background:
UIViewController *vc = [[UIViewController alloc] init];
[[vc view] setBackgroundColor:[UIColor greenColor]];
self.window.rootViewController = vc;
finally, create another view controller with a transparent background, and present it modally:
UIViewController *vc2 = [[UIViewController alloc] init];
[[vc2 view] setBackgroundColor:[UIColor clearColor]];
[vc presentModalViewController:vc2 animated:YES];
you'd expect to see the green VC through the clear VC, but instead you see red (ie, you see the window).

Resources