UINavigationController、UINavigationBar、UINavigationItem
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
CGRect screen = [[UIScreen mainScreen] bounds];
UINavigationBar *nb = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 20, screen.size.width, 44)];
UIBarButtonItem *bb1 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save:)];
UIBarButtonItem *bb2 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add:)];
UINavigationItem *ni = [[UINavigationItem alloc]initWithTitle:@""];
ni.leftBarButtonItem = bb1;
ni.rightBarButtonItem = bb2;
nb.items = @[ni];
[self.view addSubview:nb];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end