ios 自定义NavgationBar的按钮

UIImage *btnimage = [UIImage imageNamed:@"about.png"];

UIButton *btn = [[UIButton alloc] initWithFrame:self.navigationController.navigationBar.frame];

btn.showsTouchWhenHighlighted = YES;

[btn addTarget:self action:@selector(infoAction:) forControlEvents:UIControlEventTouchUpInside];

[btn setImage:btnimage forState:UIControlStateNormal];

    

UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithCustomView:btn];

[self.navigationItem setRightBarButtonItem:rightBtn];

 

你可能感兴趣的:(ios)