1.导航控制器的导航栏
[self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:34.0/255.0 green:135.0/255.0 blue:205.0/255.0 alpha:1.0 ]];
//左
UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 4, 75, 36)];
imageview.backgroundColor = [UIColor clearColor];
imageview.image = [UIImage imageNamed:@"angry_00.jpg"];
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
b.backgroundColor = [UIColor clearColor];
[b setTitle:@"猫咪" forState:UIControlStateNormal];
b.titleLabel.font = [UIFont systemFontOfSize:16.0];
[b setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
b.frame = CGRectMake(70, 4, 70, 36);
UIView *leftview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width/2, 44)];
leftview.backgroundColor = [UIColor clearColor];
[leftview addSubview:imageview];
[leftview addSubview:b];
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftview];
self.navigationItem.leftBarButtonItem = leftItem;
//右
UITextField *textfield = [[UITextField alloc] initWithFrame:CGRectMake(0, 4, 180,36)];
textfield.autocapitalizationType = UITextAutocapitalizationTypeNone;
textfield.keyboardType = UIKeyboardTypeNamePhonePad;
textfield.borderStyle = UITextBorderStyleRoundedRect;
textfield.delegate = self;
textfield.returnKeyType = UIReturnKeyDone;
textfield.secureTextEntry = NO;
textfield.clearButtonMode = UITextFieldViewModeAlways;
textfield.textColor = [UIColor blackColor];
textfield.font = [UIFont boldSystemFontOfSize:14];
UIImageView *imageview1 = [[UIImageView alloc] initWithFrame:CGRectMake(180, 4, 40, 36)];
imageview1.backgroundColor = [UIColor clearColor];
imageview1.image = [UIImage imageNamed:@"plane3"];
UIView *rightview = [[UIView alloc] initWithFrame:CGRectMake( width/2,0, width/2, 44)];
rightview.backgroundColor = [UIColor clearColor];
[rightview addSubview:imageview1];
[rightview addSubview:textfield];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightview];
self.navigationItem.rightBarButtonItem = rightItem;
2.导航控制器的push转场动画
#import <Foundation/Foundation.h>
#import "UIKit/UIKit.h"
@interface PushAnimation : NSObject<UIViewControllerAnimatedTransitioning>
@end
@implementation PushAnimation
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{
return 3.0f;
}
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{
UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
[UIView transitionFromView:fromViewController.view toView:toViewController.view duration:3 options:UIViewAnimationOptionLayoutSubviews|UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
}];
[[transitionContext containerView] addSubview:toViewController.view];
}
@end