@implementation DiErYeViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//建立button
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, 0, 40, 40);
[self.view addSubview:button];
[button setImage:[UIImage imageNamed:@"tb1"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
// 实现左上角按钮
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
// 实现右上角按钮
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
// 文字显示
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@”关闭” style:UIBarButtonItemStylePlain target:self action:@selector(clickButton:)];
}
// 实现点击的方法
- (void)clickButton:(UIButton *)button{
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end