In my program I have the main window in the background which has a smaller, UIScrollView on it. I have buttons on each page of the scroll view which I want to bring up a modal view that can be dissmissed. It works fine for the first page, however, when I click the button on the second page of the scroll view the modal view that is brought up is on top of the first page instead of the second and the second page is completely blank. When I close the modal view, the first page has been replaced with the second page and the second page is still left blank... The code I am using is:
MVC = new NewsModalViewController(this);
MVC.ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;
MVC.ModalPresentationStyle = UIModalPresentationStyle.CurrentContext;
开发者_运维问答
I've been trying to play around with the frames but having no luck...
Any insights?
Cheers
I would rewrite the subpages to fire an event that the parent view listens to. Then, display the modal from the parent view (you can actually create the modal in the child view and pass it up on the event). This eliminates any problems with the modal being applied to the wrong context.
There may be another explanation, but this is the method I've implemented on a couple applications and has served me well. It appears that modals are best displayed only from the highest level view in the stack.
精彩评论