Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing an IBAction to switch back to Main View Controller
    primarykey
    data
    text
    <p>I have an application which has a number of views which are navigated to via a number of custom UIButtons from my main view. The main view is named iBMRViewController and features some welcome graphics in the form of PNG images dropped in through interface builder. It also features 6 custom UIButtons which I have created through code using the following;</p> <pre><code>// This is the code which creates, and defines the properties of the 'Warning' button on the main view. UIButton *warningButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; warningButton.frame = CGRectMake(225.0, 270.0, 60.0, 60.0); [warningButton setTitle:@"" forState:UIControlStateNormal]; warningButton.backgroundColor = [UIColor clearColor]; [warningButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal ]; UIImage *warningButtonImageNormal = [UIImage imageNamed:@"Warning.png"]; UIImage *warningStretchableButtonImageNormal = [warningButtonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0]; [warningButton setBackgroundImage:warningStretchableButtonImageNormal forState:UIControlStateNormal]; UIImage *warningButtonImagePressed = [UIImage imageNamed:@"whiteButton.png"]; UIImage *warningStretchableButtonImagePressed = [warningButtonImagePressed stretchableImageWithLeftCapWidth:12 topCapHeight:0]; [warningButton setBackgroundImage:warningStretchableButtonImagePressed forState:UIControlStateHighlighted]; [warningButton addTarget:self action:@selector(warningButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:warningButton]; </code></pre> <p>Now, this all works fine and the buttons function perfectly, obviously I also have Actions set up for them which work perfectly. On each page I have a UINavigationBar with a UINavigationItem on set up through interface builder and set to take me back to my main view using the following code;</p> <pre><code>//This is the code which opens up the new view when 'Begin' button is tapped. -(IBAction)beginHomeButtonAction:(id)sender { iBMRViewController *controller = [[BeginView alloc] initWithNibName:@"iBMRViewController" bundle:nil]; controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; [controller release]; </code></pre> <p>This also works, however, when it takes me back to the 'iBMRViewController' it ONLY displays what was set up via the interface builder xib file (i.e. the welcome png files). It does not display the buttons I added through code. </p> <p>Can anyone give me an idea of where I have gone wrong? Would be extremely appreciated.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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