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]; 

enter image description here




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]; 

enter image description here

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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -