I have a custom view for row in UIPickerview as follow
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UIView *vw = [[UIView alloc] initWithFrame:CGRectMake(0, 0, pickerView.frame.size.width, 30)];
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, pickerView.frame.size.width, 30)];
[btn addTarget:self action:@selector(filtercategory) forControlEvents:UIControlEventTouchUpInside];
btn.showsTouchWhenHighlighted = YES;
[btn setImage:[UIImage imageNamed:@"longmp"] forState:UIControlStateNormal];
[vw addSubview:btn];
return vw;
}
The method filtercategory
didn't get called. I searched for the solution. But can't get.
Even the showsTouchWhenHighlighted
is not working.
The pickerview looks like
UiButton got added, since this is the plain white image, I tried different images to confirm.
How to make the UIButton to respond?