ios - UIToolbar accessory view for UITextField unresponsive -


i'm building uitextfield uses uipickerview allow users select list of states. in order dismiss view, tried adding uitoolbar accessory view input contains uibarbutton responds action dismiss input view. here's code it:

- (void)viewdidload {     [super viewdidload];      // load state names.     nsstring* file = [[nsbundle mainbundle] pathforresource:@"states" oftype:@"plist"];     self.states = [[nsarray alloc] initwithcontentsoffile:file];      // initialize picker view.     self.picker = [[uipickerview alloc] init];     [self.picker setdelegate:self];      // initialize button view.     toolbar = [[uitoolbar alloc] init];     [toolbar setdelegate:self];     [toolbar setbarstyle:uibarstyledefault];      done = [[uibarbuttonitem alloc] initwithtitle:@"done" style:uibarbuttonitemstyledone target:self action:@selector(resignfocus:)];      [toolbar setitems:[nsarray arraywithobjects:done, nil] animated:yes];      // set picker view state field input view.     // set done button it's accessory.     [[self state] setinputview:self.picker];     [[self state] setinputaccessoryview:self.toolbar]; } 

with code when begin editing specific text field picker , toolbar both appear. problem can't interact button - there's no indication taps through it. button doesn't highlighted buttons should , action never fired. possible picker view somehow overlapping toolbar, preventing input reaching it?

i'm developing ios7 , i'm using simulator test it.

uitoolbar doesn't have default frame, toolbar's size {0, 0}. clipstobounds no default, why can see done button. give toolbar frame , button should start working.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -