问题
I have created an iPad app. In the middle of the app, under a button I have added a split view. After the button is clicked the split is shown successfully. But in the split view I want to add a button. When the button is tapped then I want to remove the split view and show another xib in whole screen. How can I do that?
回答1:
First I had some questions,
if you able to add a Splitview on top of a viewcontroller with its button click?
In the above case do you get orientation in splitview controllers?
While I try to do I had this two problems.
Then What I do is, On a button click to show the splitview I called UIApplication Primary window, remove all current views in window and Add the new controllers view.
Do the Same as when need to go back.
See the following code,
- (void) displayControllerViewStack: (UIView *)view {
NSArray *subViews = [self.window subviews];
while ([subViews count] > 0 ) {
// Need to clear out the list, as only view at index 0 gets rotation notification.
[(UIView *)[subViews objectAtIndex:0] removeFromSuperview];
subViews = [self.window subviews];
}
[self.window addSubview: view];
}
thanks,
Naveen Shan
来源:https://stackoverflow.com/questions/9782968/remove-split-view-and-show-another-xib-in-the-whole-screen