i have made changes in navigation bar means i have increasd the height of navigation bar & made some custom changes,it works fine but when i minimizes the application and again maximize it, it shows only original height that is what changes i made, those not works after minimization, my code is
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSLog(@" i m in didFinishLaunchingWithOptions" );
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"TopHeader"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setFrame:CGRectMake(0, 0, 320, 55)];
[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:(-15.0) forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.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:@"HelveticaNeue-CondensedBlack" size:16.0], UITextAttributeFont, nil]];
return YES;
}
after maximize it goes to applicationDidBecomeActive
thats why i put above code in applicationDidBecomeActive
but its not working, why this is happening?
before minimize
after minimize & maximize again it looks like below i.e. height again automatically sets to 44.
Update: i written following code in applicationWillEnterForeground
- (void)applicationWillEnterForeground:(UIApplication *)application
{
UINavigationController *my=(UINavigationController * )self.window.rootViewController;
UINavigationBar *navigationBar = [my navigationBar];
CGRect frame = [navigationBar frame];
frame.size.height = 55.0f;
[navigationBar setFrame:frame];
NSLog(@" i m in applicationWillEnterForeground" );
}
at the time of debugging when i writes its description it shows that height is 55. but on screen it still looks like second image. why this is happening.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…