我有一个来自 viewDidLoad 的 ViewController.m 文件:
_registerButton = [AuthButton buttonWithType:UIButtonTypeSystem];
[_registerButton setTitle:@"Register" forState:UIControlStateNormal];
_registerButton.frame = CGRectMake(0.0, 0.0, self.screenWidth / 2.0 - 1.0, 60.0);
[_registerButton addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside];
...
(IBAction)buttonPressed:(UIButton *)sender
{
//sentder.titleLabel
[sender setTitle:@"Registers" forState:UIControlStateNormal];
}
registerButton 是通过属性声明的 AuthButton。如何覆盖 buttonPressed 并将我的 IBAction 代码移动到我的 AuthButton.m 类?对语法感到困惑(objective-c 的新手)。