iPad UIPopOverController - is it possible to have transparent background? - ipad

Does anyone know if it possible to have a transparent background for a UIPopOverController on the iPad?
I'd like to put a semi-transparent view inside the popover (hence the desire for the popover itself to have a transparent background).
I think it can't be done ... but I'd love to know if I am wrong!

I think that setting the transparency of the view in the popover won't work, but I've never tried it and it might.
Anyways, another cool way would be to take a UIImage rendering of the main UIView inside the popover controller.
Once you have this image, you can follow this process, assuming that you also know where the popover is positioned (its CGRect) relative to the view controller that opened it.
Hide popover.
Show rendered UIImage in a transparent UIImageView at the same position. (You can add a little border yourself so that it looks like the popover too.)
Reshow the popover.
The effect would be that the UIPopoverController "faded".
I know its a hard way to do it if the first solution also works, but this might be cool project to take on.

Why not add a View whose alpha is setted to 0.5 before showing popover view
then use
presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated;
method of popover passing the created view's reference.

It is possible to have UIPopOverController to have semi-transparent background. Check the following example.
[[[myPopOverController contentViewController] view] setAlpha:0.25f];

Usually popover control wil be transparent,we cant change the popover control to semi-transparent view

Related

iOS 7 UINavigationController Push animation shadow

With iOS 7 a new push animation was created, which slides the pushed view controller on top of the hierarchy. But when the animation happens, iOS apparently does two things to modify the design of the top view controller:
A shadow is added:
And a light overlay over the bottom view controller:
In most applications this is not a problem. But, I am currently working on an application with pixel perfect design and I use view controllers with clear background. But this functionality remains the same, and the light overlay appears over the view controller. Because the background is a white gradient, this light overlay (on screenshot 2) is very visible and when the animation completes, it is removed without animation, which makes it very noticeable and annoying.
I am aware I can create custom animations and transitions, but I am wondering:
Is there any way to remove (or modify) this light overlay and shadow, without having to create custom transitions?
Thank you for your help.
It's not the most elegant solution, but I've seen people use UIImage animations to show what they want shown. So, you could:
Screenshot the incoming UIViewController
Animate the arrival of a UIImageView
Call pushViewController:animated:, passing NO for animated:
Remove the UIImageView
Again, a bit of a hack, but maybe it's the best solution for your scenario.
Try this proxy
[[UIImageView appearanceWhenContainedIn:NSClassFromString(#"_UIParallaxDimmingView"), nil] setAlpha:0.0f];
I don't know if Apple allows this or not because it uses a private API. Will update when app submitted.

Custom background for UIActionSheet in a UIPopoverController on iPad

What I'm basically doing is presenting a UIActionSheet using showFromBarButtonItem from a UIBarButtonItem in a UINavigationBar in an iPad app. What this does is present the UIActionSheet in a popover, which is what I wanted.
What I would like to do is change the background color of said popover from the default blue to one of my own. Is there a simple app store safe way to accomplish this short of rolling my own custom UIActionSheet in a popover solution?
Not really, because you don't get official access to any parts of the underlying UIPopoverController or its content view controller, let alone the view. On the other hand, as you imply, constructing your own view controller and view is pretty trivial.
It would be quite easy to create your own view with behavior similar to UIActionSheet
Here's an example: http://iosdevtricks.blogspot.com/2013/04/ipad-style-action-sheet-for-iphone.html

UINavigationController with custom vertical button bar

I need to implement a navigation based app with a custom made button bar that stays on the vertical size of the screen, similar to Reeder iPad app (see Reeder screenshot).
What is the best way to achieve that result? I thought about adding the bar as a subview of the UINavigationController and calling its methods (like pushViewController:animated:) via the parentViewController reference from my button bar view controller, but it seems a bit convoluted.
Might work, but dangerous: set a transform on the CALayer object of the UINavigationBar. A transform that rotates the bar by "-1 * M_PI_2" would be almost right, you might need to translate it a few pixels too, to get the position correct.
Definitely works, but more effort: render a custom navbar, implement the delegate protocol from UINavigationController, and listen to the nav changing, and implement your own animations inside the callbacks.
(I've done the latter method to provide custom UINavigationBars - it works fine)
The only caveat with latter method is that your animations might pause / delay because by default they wait for each other to finish. If you look at the UIView animations, there's a setting that says "play immediately, even if other animations are in progress", and you might need to set that to YES.

Specific iPad modal view

Okay, I am still learning how to program and things are moving along quite well, but I have a question for the group about something that has been plaguing me:
How do I create a pop view where the background can still be seen? I mean, say my iPad view has 5 buttons on it, and I want a small square to pop up over where that button was, asking the user a question - how would i do that? Can I make a modal view with an invisible background? (I don't want a UIAlert BTW - I know that would solve my problem, but I am trying to learn how to do this with my own view)
Can anyone point me in the right direction?
You say "pop view" which makes me think you're describing a popover. Have you read the iPad Programming Guide, specifically, the section "Creating and Presenting a Popover"? It really is required reading in this case.
Are you showing the popover from a bar button? If so, you'll want to use presentPopoverFromBarButtonItem:permittedArrowDirections:animated:. If not, you'll need to identify a CGRect that represents the button (you can use its bounds), and then use presentPopoverFromRect:inView:permittedArrowDirections:animated:.
You do not want to obscure the button with the popover. When you show the popover using the above methods, the framework will take care of positioning the popover on-screen. Use the UIPopoverArrowDirectionAny for directions whenever possible.
If you actually want to show a modal view, you can create whatever view you want and then display it in such a way that the background is not fully obscured. Just set the modalPresentationStyle of the view controller to something like UIModalPresentationPageSheet.
You should create a custom UIView with the dimensions and content that you want to display. Then, you can place the custom UIView on screen by calling something like:
//where 'self' is the view controller currently visible and 'customView' is
//the view which has the question for the user. Don't forget to set the
//frame property on customView so that it knows the correct place to display.
[self.view addSubview:customView];
Hope this helps. Andrew

customize uipopovercontroller in ipad

i want to change the image of popover. it is having blue tint at the top so i want it to be of different color. how can i do it...
- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
can i do it with this method.. make my own view and place a image in that view.
i read in some posts that it is not possible to change color and also i didnt fine any instance method of UIPopOverController class to do this..
thanks in advance.
You cannot customize a popover the way you want. The view you see is the popover's content. Popovers are always the way it is, black.
Maybe I am misunderstanding the question but it seems like it is possible to designate custom UIPopoverView backgrounds:
UIPopoverBackgroundView. Haven't got around to trying this myself.
The UIPopoverBackgroundView class provides the background appearance for a popover. This class is abstract and must be subclassed before it can be used. The implementation of your subclass is responsible for providing the border decoration and arrow for the popover. Subclasses must also override all declared properties and methods to provide information about where to lay out the corresponding popover content and arrow.

Resources