Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Narendar Singh

macrumors member
Original poster
Jun 22, 2012
76
0
INDIA
Hi,

I have a ViewController1 which has one button named "show".

When I click on "show" it displays ViewController2 as popover.

ViewController2 has a button "Close".

What I want, when I click on "Close" button from ViewController2 it should be dismissed/disappear.

Note: When I click on any other place on the screen ViewController2 disappears, and this is ok.
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,871
228
Novi, MI
You need to keep an instance variable of that popover controller in your main view controller. You should then set the main view controller as a delegate of your popover, and in your popover have the button push send a delegate method that tells the mainviewcontroller to use the method of the popover instance dismissPopoverAnimated:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.