UrbanApps / UAModalPanel

An animated modal panel alternative for iOS

Home Page:http://code.coneybeare.net/uamodalpanel-an-open-source-modal-panel-alter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graphical glitch as sub view of tabbarcontroller.

Hackmodford opened this issue · comments

I've added the panel as a sub view of my tabbarcontroller controller. When the app rotates, the grey background doesn't cover the navbar or the tabbar. When the rotation finishes it appears normal again. Any Ideas?

pic? code?

This is my code

[self.customImageView whenTapped:^{

            MA_MobileAppDelegate *appDelegate = (MA_MobileAppDelegate *)[[UIApplication sharedApplication] delegate];

            UAModalPanel *modalPanel = [[MSPicturePreview alloc] initWithFrame:appDelegate.tabBarController.view.bounds withimage:self.customImageView.image];

            [appDelegate.tabBarController.view addSubview:modalPanel];


            [modalPanel showFromPoint:[self.contentView convertPoint:[self.customImageView center] toView:appDelegate.tabBarController.view]];

        } ];

Here are some pics demonstrating the issue.

http://dl.dropbox.com/u/6851931/2012-06-17%2011.08.42.jpg

http://dl.dropbox.com/u/6851931/2012-06-17%2011.08.47.jpg

If you look at the pic that's rotating you can see how the navbar is lighter than when it has fully rotated.

The rotation of the UIModalPanel is standard UI rotation code. The reason you are seeing this is because the panel's background (the transparent dark mask) is being applied to the view, and not being applied to the window itself.

The way to solve it would be to make the background of the modalPanel view clear instead, then create a new subview with the semi-transparent masking layer and add it to the the window instead of the controller view. It would have to be added underneath the modalPanel, so some reworking would need to be done, but it is doable. The modalPanel would still be added to the controller. If you add it, be sure to submit a pull request.

Alternatively, you could not change any code and add the panel to the window itself, but then you lose all the auto-rotation that comes built in with adding a view to a view controller. You would have to implement your own rotation transform code and logic.

What about adding a new view to the app window in the app delegate that's only used for this? Would that be simpler?

You could change the background color in the modalPanel to clear and then add a mask view yourself to the window. You would have to add the animation code to have it fade in and logic to fade it out it when the panel is removed but otherwise should work fine.