UIPickerView subclass, toolbar subview not responding to touches?
I've created a subclass of UIPickerView. In this subclass I've added a UIToolbar as a subview. The toolbar appears the way I specified in my code, howeve开发者_如何学Pythonr the done button in the toolbar is not recognizing any touch events.
What am i doing wrong?
Update:
The done button is being created like this,
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed:)];
i suspect you are not using the right control event for toolbar items (esp if it is segmented control).
use UIControlEventValueChanged
if you are using UIControlEventTouchUpInside
. If that is not the case, please post some code to address the issue.
Also, make sure Toolbar is within the frame of your Pickerview for it to respond to the touches, else touches wont reach to ToolBar.
精彩评论