如果想将方法作为参数传递,该如何操作
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view.
[selfbuttonAction:@selector(testAction)];
}
- (void)buttonAction:(SEL)button{
self.button= [[UIButtonalloc]initWithFrame:CGRectMake(100,100,100,100)];
self.button.backgroundColor= [UIColorredColor];
self.button.showsTouchWhenHighlighted=YES;
[self.buttonaddTarget:selfaction:buttonforControlEvents:6];
[self.viewaddSubview:self.button];
}
- (void)testAction{
[BassViewControllerbuttonAction];
}
网友评论