Monday, 13 January 2014

iOS 7 Layout changes | XCode5

Hey Folks,
Here some fixes/changes on iOS7:

1) UINavigationBar Background Image :
 if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
    [[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"navbar_bg_ios7.png"]forBarMetrics:UIBarMetricsDefault];
else
    [[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"navbar_bg.png"]forBarMetrics:UIBarMetricsDefault];

Important :Image should be of 320px x 64px (if you want to support lower versions, then you have to add another image of 320px x 44px)

2) UINavigationBar title color : (By default Black color in iOS7)
[[UINavigationBar appearance]setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor];forKey:UITextAttributeTextColor]];

3) UIBarButtonItem title color : (By default Blue color in iOS7)
[[UIBarButtonItem appearance]setTintColor:[UIColor whiteColor]];


4) UISearchBar Style + Cancel barButtonItem color :
[self.searchBar setSearchBarStyle:UISearchBarStyleMinimal];
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class,nil]setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:kBlueTintColor,UITextAttributeTextColor,[NSValue valueWithUIOffset:UIOffsetMake(0,1)],UITextAttributeTextShadowOffset,nil]forState:UIControlStateNormal];

5) APPDelegate Window
 self.window.tintColor = [UIColor whiteColor]; 

Important: Beware to use this code. Every UI elements traits behaves as in white color(i.e UIbarbutton item, keyboard focus etc..)

6) UITextView | UITextField focus color
[[UITextView appearance] setTintColor:kBlueTintColor]

No comments:

Post a Comment