فهرست منبع

Menu: Leverage using a UINavigationController

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Romain Goyet 12 سال پیش
والد
کامیت
bd64685089
2فایلهای تغییر یافته به همراه10 افزوده شده و 8 حذف شده
  1. 2 1
      AspenProject/VLCAboutViewController.m
  2. 8 7
      AspenProject/VLCMenuViewController.m

+ 2 - 1
AspenProject/VLCAboutViewController.m

@@ -36,7 +36,8 @@
     [dismissButton setBackgroundImage:[UIImage imageNamed:@"doneButton"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
     [dismissButton setBackgroundImage:[UIImage imageNamed:@"doneButtonHighlight"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
     [dismissButton setTitleTextAttributes:@{UITextAttributeTextShadowColor : [UIColor whiteColor], UITextAttributeTextColor : [UIColor blackColor]} forState:UIControlStateNormal];
-    self.navigationItem.rightBarButtonItem = dismissButton;
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+        self.navigationItem.rightBarButtonItem = dismissButton;
 }
 
 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

+ 8 - 7
AspenProject/VLCMenuViewController.m

@@ -117,13 +117,14 @@
 {
     UIViewController *aboutController = [[VLCAboutViewController alloc] initWithNibName:nil bundle:nil];
 
-    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:aboutController];
-    navController.navigationBar.barStyle = UIBarStyleBlack;
-    [navController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBarBackground"] forBarMetrics:UIBarMetricsDefault];
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
-        [navController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBarBackgroundPhoneLandscape"] forBarMetrics:UIBarMetricsLandscapePhone];
-
-    [self presentModalViewController:navController animated:YES];
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:aboutController];
+        navController.navigationBar.barStyle = UIBarStyleBlack;
+        [navController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBarBackground"] forBarMetrics:UIBarMetricsDefault];
+        [self presentModalViewController:navController animated:YES];
+    } else {
+        [self.navigationController pushViewController:aboutController animated:YES];
+    }
 }
 
 - (IBAction)openNetworkStream:(id)sender