Hello, I am trying to display a new subview in my app. I have already created the subview and added it to the UIWindow. This is inside my appDelegate:[and as a side note if i comment out the second line the resultsController.view will display]
(resultsController.view is what I am trying to display). Once I have these views added I am trying to display resultsController.view when a button is pressed in viewController.view. Currently the button runs a function inside of the appDelegate. I have tried a number of things including:
And then calling this function from inside the function called when the button is pressed. Along with a number of other ideas like adding the subview once the button has been pressed, removing the other subview when the button is pressed, etc etc... There is something I am obviously missing here and no amount of google search will discover what it is.
Thanks,
Josh
Code:
[window addSubview:resultsController.view];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
Code:
-(IBAction)buttonPressed:(id)sender
{
vmAppDelegate *delegate=[vmAppDelegate new];
NSLog(@"buttonpressed");
[delegate.window addSubview:delegate.resultsController.view];
[delegate connectToProject:URLField.text];
}
Code:
-(void)displayNewView:(UIView*)viewToDisplay
{
NSLog(@"displaynewview");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES];
[window bringSubviewToFront:viewToDisplay];
[UIView commitAnimations];
}
Thanks,
Josh