ios - How to use the Toolbar with UIKeyboard in table view cell -
i have issue [uitextview(toolbar) addkeyboardtoolbar]
, in tableview:cellforrowatindexpath
added method [cell.textview addkeyboardtoolbar];
i got issue in crashly like
crashed: com.apple.main-thread exc_bad_access kern_invalid_address @ 0x00000008
this code below. can please me on thankz in advance.
- (void)addkeyboardtoolbar { uitoolbar *toolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0.0f, 0.0f, self.bounds.size.width, 44.0f)]; [toolbar setbarstyle:uibarstyleblack]; [toolbar settranslucent:yes]; // toolbar.items=[nsarray arraywithobjects: [[uibarbuttonitem alloc]initwithtitle:@"spacer" style:uibarbuttonitemstylebordered target:self action:nil], // [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil], // [[uibarbuttonitem alloc]initwithtitle:@"done" style:uibarbuttonitemstyledone target:self action:@selector(hidekeyboard)], // nil]; // [toolbar sizetofit]; uibarbuttonitem *spacer = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil]; uibarbuttonitem *done = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(hidekeyboard)]; [toolbar setitems:[nsarray arraywithobjects:spacer, done, nil] animated:yes]; [toolbar setautoresizingmask:uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight]; if ([self iskindofclass:uitextfield.class]) { [self setinputaccessoryview:toolbar]; } else if ([self iskindofclass:uitextview.class]) { [self setinputaccessoryview:toolbar]; } //return toolbar; }
Comments
Post a Comment