我正在将下一个全局格式应用于我的应用程序:
-(void)customizeAppearance{
//Customizing UINavigationBar
UIImage *navigationbarImage44 = [[UIImage imageNamed:@"navigationbar_44"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *navigationbarImage32 = [[UIImage imageNamed:@"navigationbar_32"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
//Set the background image for *all* UINavigationBars
[[UINavigationBar appearance] setBackgroundImage:navigationbarImage44 forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:navigationbarImage32 forBarMetrics:UIBarMetricsLandscapePhone];
//Customize the titlebar for *all* the navigationBars
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0], UITextAttributeTextColor,
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:labelFontName size:0.0], UITextAttributeFont,
nil]];
//Customizing UIToolbar
UIImage *toolbarImage44 = [[UIImage imageNamed:@"toolbar_44"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *toolbarImage32 = [[UIImage imageNamed:@"toolbar_32"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIToolbar appearance] setBackgroundImage:toolbarImage44 forToolbarPosition:UIToolbarPositionAny
barMetrics:UIBarMetricsDefault];
[[UIToolbar appearance] setBackgroundImage:toolbarImage32 forToolbarPosition:UIToolbarPositionAny
barMetrics:UIBarMetricsLandscapePhone];
//Customizing UIBarButtonItem
UIImage *button30 = [[UIImage imageNamed:@"buttonitem_30"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
UIImage *button24 = [[UIImage imageNamed:@"buttonitem_24"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
[[UIBarButtonItem appearance] setBackgroundImage:button30 forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackgroundImage:button24 forState:UIControlStateNormal
barMetrics:UIBarMetricsLandscapePhone];
//Customizing UIBarButtonItem BackButton
[[UIBarButtonItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0], UITextAttributeTextColor,
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:labelFontName size:0.0], UITextAttributeFont,
nil]forState:UIControlStateNormal];
UIImage *buttonBack30 = [[UIImage imageNamed:@"backbuttonitem_30"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)];
UIImage *buttonBack24 = [[UIImage imageNamed:@"backbuttonitem_24"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 12, 0, 5)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBack30
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBack24
forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone];
//Customizing UISegmentedControl
[[UISegmentedControl appearance] setTintColor:(UIColorFromRGB(toolbarTintColor))];
//Customizing UISearchBar
[[UISearchBar appearance] setBackgroundImage:navigationbarImage44];
}
我在我的 AppDelegate.m 方法中调用它
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[self customizeAppearance];
return YES;
}
问题是:
如果 viewController 不在 iPad 弹出窗口中,我如何调整所有这些通用格式???
我不希望我的弹出窗口共享原始格式,我希望它们与 UINavigationBars、UIToolbars、UIBarButtonItems.. 一如既往的黑色
提前感谢您的支持