ios - UIActionSheet - "init" changes button style -
why button style on uiactionsheet "cancel" button change when add "init" after allocating , initializing once?
if use code shows properly:
uiactionsheet *popupquery = [[uiactionsheet alloc] initwithtitle:@"photo/camera" delegate:nil cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"capture - camera", @"upload - photo library", nil]; popupquery.actionsheetstyle = uiactionsheetstyleblackopaque; [popupquery showinview:self.view];
if use code (with ...init]
added) shows im-properly , "cancel" button style changed:
uiactionsheet *popupquery = [[[uiactionsheet alloc] initwithtitle:@"photo/camera" delegate:nil cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"capture - camera", @"upload - photo library", nil] init]; popupquery.actionsheetstyle = uiactionsheetstyleblackopaque; [popupquery showinview:self.view];
i'm assuming question of curiosity (there no valid reason double "init").
the second init
resets many of ivars setup in first initwithtitle...
. cancelbuttonindex
being reset cancel button appears regular button.
Comments
Post a Comment