0
UIButton의 @selector 메서드에서 인수를 전달하는 방법은 무엇입니까?예를 들어 @selector에서 인수를 전달하려면 어떻게해야합니까?
-(void)loadView{
UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
btn1.tag=1;
[btn1 addTarget:self action:@selector(showRestaurant:tag:) forControlEvents:UIControlEventTouchDown];
btn1.frame = CGRectMake(2370.828125,1020.015625,35,34);
[imageView addSubview:btn1];
}
-(void)showRestaurant:(NSInteger)tag{
NSLog(@"x=%d",tag);
}
여기이 메소드 showRestaurant에 대한 태그 값을 가져 오려고합니다.
친절히 도와주세요!