Я нахожу пути.просто в
- (UIView*)pickerView:(UIPickerView *)pickersView viewForRow:(NSInteger)row
forComponent:(NSInteger)component reusingView:(UIView *)view
{
PickerCustomView * rowView = [[PickerCustomView alloc]initWithFrame:CGRectMake(5, 0, 310, 50) withText:[[localFlagNotes objectAtIndex:row] value]] ;
rowView.delegate = self;
return rowView;
}
Создать пользовательский вид с помощью кнопки
Как это
- (id)initWithFrame:(CGRect)frame withText:(NSString*)text
{
self = [super initWithFrame:frame];
if (self)
{
deleteButton = [[UIButton alloc]init];
[deleteButton setImage:[UIImage imageNamed:@"IconTrash"] forState: UIControlStateNormal];
[deleteButton addTarget:self action:@selector(deleteButtonAction:) forControlEvents:UIControlEventTouchUpInside];
deleteButton.frame = CGRectMake(250, 10, 35,35);
textLabel = [[UILabel alloc]init];
originText = text;
NSString *trimmed = [text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
textLabel.text = trimmed;
textLabel.font = [UIFont fontWithName:@"Arial" size: 24];
textLabel.frame = CGRectMake(20, 10, 230, 28);
textLabel.backgroundColor = [UIColor clearColor];
[self addSubview:textLabel];
[self addSubview:deleteButton];
}
return self;
}
И использовать:
-(void)deleteButtonAction:(id)sender
{
[delegate removeCellAtIndexPath:originText];
}
Или:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if ( (location.x > 10 && location.x < 38) && (location.y > 240 && location.y < 265) )
{
[self deleteButtonAction:nil];
}
}