I've subclassed UIPickerView to add some a little more functionality(I'm 99% sure it has nothing to do with this question). In drawRect I added a toolbar to make dismissing the toolbar a little easier, the problem is, neither the UIToolbar, or the UIBarButtonItem inside the toolbar receive touches. It's almost as if the view is "invisible" in that the touches are forwarded to the view behind it(a UITableView). I know I could just make a "control" view that holds both the picker an a toolbar. But I just wanted to know if there was any way to do this without creating another view?
Here's my drawRect code:
- (void)drawRect:(CGRect)rect
{
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
pickerToolbar = [[UIToolbar alloc] initWithFrame: CGRectMake(0, 0, self.frame.size.width, 40)];
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target: self.delegate action: closeAction];
[pickerToolbar setItems: [NSArray arrayWithObject: closeButton]];
[self addSubview: pickerToolbar];
}
}
Here's a photo: