按鈕在viewForRow不響應:UIPickerView的UIButton在viewForRow不響應
UIView * rowView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 44)] autorelease];
UIButton* deleteButton = [[[UIButton alloc]init]autorelease];
deleteButton.frame = CGRectMake(200, 10, 20,20);
[deleteButton setImage:[UIImage imageNamed:@"IconTrash.png"] forState: UIControlStateNormal];
[deleteButton addTarget: self action:@selector(removeCellAtIndexPath:) forControlEvents: UIControlEventTouchUpInside];
UILabel *labelText = [[UILabel alloc]init];
labelText.text = [NSString stringWithFormat:@"%@",[[localFlagNotes objectAtIndex:row] value]];
labelText.font = [UIFont fontWithName:@"Arial" size: 24];
labelText.frame = CGRectMake(0, 10, 200, 28);
labelText.backgroundColor = [UIColor clearColor];
[rowView addSubview:labelText];
[rowView addSubview:deleteButton];
[labelText release];
return rowView;
removeCellAtIndexPath
按下按鈕後不會調用。有人有一些想法,爲什麼和一些解決方案?
我覺得按鈕甚至沒有按下只有細胞變得活躍。
它不適合我 –