Note that there are some explanatory texts on larger screens.

plurals
  1. POUIButtons not working
    text
    copied!<p>I have some Objective-C code to transition between two views. I have the transition code. What I would like to do is transition to a view on a button press, however this only seems to work when I generate the button with code, it won't work with a button I create in IB and link to the code (using File's Owner, etc.).</p> <p>Here is my some of my code:</p> <pre><code>- (void)goToTwo { ALPHAAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; [appDelegate displayView:2]; } - (void)viewDidLoad { NSLog(@"load01"); //Button Code UIButton *btnOne = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btnOne.frame = CGRectMake(40, 40, 240, 30); [btnOne setTitle:@"One!" forState:UIControlStateNormal]; [btnOne addTarget:self action:@selector(goToTwo) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btnOne]; [super viewDidLoad]; } </code></pre> <p>When the view loads, I am creating a button so that I have two, one created with code, one in IB, both of which at the moment will do the same thing (transition to next view),</p> <p>My .h file:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface View1 : UIViewController { } -(IBAction) goToTwo:(id)sender; @end </code></pre> <p>I'm pretty sure I linked the button to the function correctly, dragging the node next to TouchUpInside over to the File's Owner and then clicking on the method name.</p> <p>Any ideas on why the code generated button works and the IB button doesn't?</p> <p>Thanks a lot in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload