ios - How to get grouped looking UIActionSheet buttons when dynamically adding them -
normally, when add together buttons uiactionsheet statically so:
uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles: @"yu", @"gi", @"oh", nil]; the appearance of uiactionsheet appear grouped so, cancel buttons separate group:
however, need add together buttons dynamically depending on user actions, found out if this:
uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles: nil]; [actionsheet addbuttonwithtitle:@"yu"]; [actionsheet addbuttonwithtitle:@"gi"]; [actionsheet addbuttonwithtitle:@"oh"]; //this example, add together more or less the resulting uiactionsheet looks this:
how able add together buttons dynamically still have them appear grouped 1 when adding buttons statically?
thanks!
you need set cancel button others:
uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:nil destructivebuttontitle:nil otherbuttontitles: nil]; [actionsheet addbuttonwithtitle:@"yu"]; [actionsheet addbuttonwithtitle:@"gi"]; [actionsheet addbuttonwithtitle:@"oh"]; //this example, add together more or less actionsheet.cancelbuttonindex = [actionsheet addbuttonwithtitle:@"cancel"]; ios ios7 uiactionsheet
No comments:
Post a Comment