Sunday, 15 June 2014

ios - Programmatically add UIButton to custom ViewController with storyboard in place -



ios - Programmatically add UIButton to custom ViewController with storyboard in place -

i've implemented walkthrough screens next appcoda's create uipageviewcontroller using storyboard tutorial. @ end of illustration uipagecontrol created in code , i'm trying add together uibutton same way, programmatically.

the button appears if added via storyboard otherwise none of these have worked me when (individually) added viewdidload:

uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect]; [button settitle:@"show view" forstate:uicontrolstatenormal]; button.frame = cgrectmake(80.0, 210.0, 160.0, 40.0); // [self.view addsubview:button]; // [self.view bringsubviewtofront:button]; // [self.view insertsubview:button atindex:0]; // [self.view insertsubview:button atindex:[self.view subviews].count + 1]; // [self.view insertsubview:button abovesubview:self.view]; // [self initbutton:button];

there's got relatively simple i'm missing. should stick android?

just uncomment [self.view addsubview:button]; line , should work. if doesn't work believe have other view added on top of self.view hover on button.

ios iphone objective-c xcode uibutton

No comments:

Post a Comment