iphone - Why is my UIToolbar appearing in an odd position? -
iphone - Why is my UIToolbar appearing in an odd position? -
i want add together uitoolbar
keyboard uitextfield
. here code i'm using:
uitoolbar *toolbar = [[uitoolbar alloc] init]; toolbar.tintcolor = [uicolor blackcolor]; uibarbuttonitem *donebutton = [[uibarbuttonitem alloc] initwithtitle:@"done" style:uibarbuttonitemstylebordered target:self action:@selector(somefunction)]; donebutton.tintcolor = [uicolor blackcolor]; uisegmentedcontrol *directioncontrol = [[uisegmentedcontrol alloc] initwithitems:[nsarray arraywithobjects:@"back", @"next", nil]]; directioncontrol.tintcolor = [uicolor blackcolor]; directioncontrol.segmentedcontrolstyle = uisegmentedcontrolstylebar; [directioncontrol addtarget:self action:@selector(directioncontrolpressed) forcontrolevents:uicontroleventvaluechanged]; uibarbuttonitem *segitem = [[uibarbuttonitem alloc] initwithcustomview:directioncontrol]; uibarbuttonitem *flexiblespace = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil]; [toolbar setitems:[nsarray arraywithobjects:segitem, flexiblespace, donebutton, nil]]; // assign toolbar text fields self.textfield.inputaccessoryview = toolbar;
however, here looks when run code:
the toolbar
doesn't seem high enough; notice tint colour of toolbar hasn't been acknowledged.
please can help me out?
think need set toolbar's frame, @ to the lowest degree size. recall, used [toolbar sizetofit]
height , had utilize window width width.
iphone ios uitoolbar uikeyboard
Comments
Post a Comment