如何在导航栏上实现Bar Button项目,使用我想要导航到另一个页面的Bar Button项目,因为我是iphone开发的新手,请寻求您的帮助。 提前致谢
答案 0 :(得分:1)
UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithTitle:@"title" style:UIBarButtonItemStylePlain target:self action:@selector(btnAction)];
[self.navigationItem setRightBarButtonItem:rightBarButton];
[rightBarButton release];
答案 1 :(得分:0)
试试这个:
UIButton *btnPrev =[[UIButton alloc] init];
[btnPrev setBackgroundImage:[UIImage imageNamed:@"btnPrevious.png"] forState:UIControlStateNormal];
btnPrev.frame = CGRectMake(100, 100, 50, 30);
[btnPrev addTarget:self action:@selector(backButtonClicked) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *btnBack =[[UIBarButtonItem alloc] initWithCustomView:btnPrev];
self.navigationItem.leftBarButtonItem = btnBack;