如题
新建一个xib,添加一个toolBar,增添两个UIBarButtonItem分别命名为上移,下移
然后怎么在ViewController里监听这两个按钮点击啊
要求:不能用连线的方法监听按钮点击(以免造成高耦合性)
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//Add button to NavigationController
UIBarButtonItem *backButton =
[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"back", @"")
style:UIBarButtonItemStylePlain
target:self
action:@selector(goBack)];
self.navigationItem.leftBarButtonItem = backButton;
}
//Perform action on back Button
- (void) goBack { // Go back task over-here
}
设置action?