我想在按下 uibutton 时将它的标签传递给指定的方法,但是当我尝试这个时,我收到一条错误消息。请帮忙。代码:
UIButton *deleteButton = [[UIButton alloc]initWithFrame:CGRectMake(230, dateLabel.frame.origin.y, 70, 27)];
[deleteButton addTarget:self action:@selector(deleteButtonPressed:i) forControlEvents:UIControlEventTouchDown];
[deleteButton setBackgroundImage:[UIImage imageNamed:@"delete.jpg"] forState:UIControlStateNormal];
[deleteButton setTag:i];
进而
-(void)deleteButtonPressed:(int)tag
{
NSLog(@"Button Pressed");
NSLog(@"%i", tag);
}