Switching to another UIView, within TabBar
Here is my app setup.
TabBar App with three tab items, tabs 2 and 3 are irrelevant
The TabBarController is located within MainWindow.xib
In interface builder for MainWindow.xib, within the TabBarController i have the seperate viewControllers for each tab. Then a view for each view controller underneath ( this can been seen when viewing the object in list view)
The application loads and displays the first tab. I want to be able to have a button in the view of the first tab that can be clicked that will then animate the following: the current view fading out a new view fading in within the SAME tab. Would the new view require a new viewcontroller开发者_如何学C or just an additional view under the view controller? or can i create a new view controller and load that with its view?
how would i go about this? just the method is needed.
How would i go about this? Thanks
EDIT
my interface builder list looks like this
Where should i place this new view?
You don't need the additional view controller. Just add additional view in current controller's view and that will be good enough. When user touch up on button make animation that will adjust transparency of views for desired duration. After animation is finished set transparent view as hidden so it won't capture the user actions.
@interface NewsletterViewController {
IBOutlet UIView *view1;
IBOUtlet UIView *view2;
}
In interface builder, add this views to NewsletterViewController->View and connect them with these outlets.
Some code for animation setup:
[UIView beginAnimations: @"Fade" context: nil];
[UIView setAnimationDuration: 0.5];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(onFadeFinished)];
view1.alpha = 0;
view2.alpha = 1
[UIView commitAnimations];
精彩评论