标签:style blog color 使用 io for cti 代码
1.设置导航栏样式
[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"navibarbackground"] forBarMetrics:UIBarMetricsDefault]; [self.navigationBar setTintColor:[UIColor whiteColor]];//BarItem颜色 NSShadow *shadow = [NSShadow new]; shadow.shadowColor = [UIColor blackColor]; shadow.shadowOffset = CGSizeMake(3, 3); [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont fontWithName:@"AmericanTypewriter"size:23],NSShadowAttributeName:shadow}];
2.
不想标题栏是光秃秃的文字?您可以通过使用代码行中的图像或标志取代它: 1 self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"appcoda-logo.png"]];
3.导航栏入栈动画
-(IBAction)pushAction:(id)sender { CATransition *animation = [CATransition animation]; [animation setDuration:1.3]; [animation setType:kCATransitionFade]; //淡入淡出 [animation setSubtype:kCATransitionFromLeft]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; SecondViewController *second = [SecondViewController new]; [self.navigationController pushViewController:second animated:NO]; [self.navigationController.view.layer addAnimation:animation forKey:nil]; }
通过类目为导航栏添加动画的方法
#import "UINavigationController+CustomPushOrPop.h" @implementation UINavigationController (CustomPushOrPop) -(void)customPushViewContrller:(UIViewController *)viewContrller { viewContrller.view.frame = CGRectMake(0,-viewContrller.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height); [self pushViewController:viewContrller animated:NO]; [UIView animateWithDuration:0.35f animations:^ { viewContrller.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); } completion:^(BOOL finished) { }]; }
.
标签:style blog color 使用 io for cti 代码
原文地址:http://www.cnblogs.com/huen/p/3871675.html