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 aCGRectthat represents the button (you can use itsbounds), and then usepresentPopoverFromRect: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
UIPopoverArrowDirectionAnyfor 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
modalPresentationStyleof the view controller to something likeUIModalPresentationPageSheet.