ios - How to modify a Done button programmatically from UIActionSheet? -
i have method create action sheet , uipicker:
-(void)presentnewpicker{ self.aac = [[uiactionsheet alloc] initwithtitle:@"what city?" delegate:self cancelbuttontitle:nil destructivebuttontitle:nil otherbuttontitles:@"ok", nil]; self.pickrview = [[uipickerview alloc] initwithframe:cgrectmake(0.0, 44.0, 0.0, 0.0)]; self.pickrview.showsselectionindicator = yes; self.pickrview.datasource = self; self.pickrview.delegate = self; self.citynames = [[nsarray alloc] initwithobjects: @"phoenix", @"tahoe", @"nevada", @"lime", @"florida", nil]; uitoolbar *pickerdatetoolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, 0, 320, 44)]; pickerdatetoolbar.barstyle = uibarstyleblackopaque; [pickerdatetoolbar sizetofit]; nsmutablearray *baritems = [[nsmutablearray alloc] init]; uibarbuttonitem *flexspace = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:self action:nil]; [baritems addobject:flexspace]; uibarbuttonitem *donebtn = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(dismissactionsheet:)]; [baritems addobject:donebtn]; [pickerdatetoolbar setitems:baritems animated:yes]; [self.aac addsubview:pickerdatetoolbar]; [self.aac addsubview:self.pickrview]; [self.aac showinview:self.view]; [self.aac setbounds:cgrectmake(0,0,320, 464)]; }
the button appears reads done want modify read, ready. how accomplish this?
replace:
uibarbuttonitem *donebtn = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(dismissactionsheet:)];
with:
uibarbuttonitem *donebtn = [[uibarbuttonitem alloc] initwithtitle:@"ready" style: uibarbuttonitemstylebordered target:self action:@selector(dismissactionsheet:)];
you may want use uibarbuttonitemstyledone
style.
Comments
Post a Comment