Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 5, 2013, 12:34 AM   #1
Narendar Singh
macrumors member
 
Join Date: Jun 2012
Location: INDIA
Send a message via Skype™ to Narendar Singh
How to dismiss popover view on button click in iPad

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.
__________________
Finite Disappointment Vs Infinite Hope
Narendar Singh is offline   0 Reply With Quote
Old Feb 5, 2013, 07:17 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
ViewController2 will need access to the UIPopoverController and call dismissPopoverAnimated:
robbieduncan is offline   0 Reply With Quote
Old Feb 5, 2013, 07:20 AM   #3
waterskier2007
macrumors 68000
 
waterskier2007's Avatar
 
Join Date: Jun 2007
Location: White Lake, MI
Send a message via AIM to waterskier2007
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:
__________________
2012 Mac Mini, 2.6 GHz, 16GB RAM, 1TB HDD
2.4Ghz 15" Macbook Pro
16 GB iPhone 5 : 32 GB iPhone 4S : 16 GB iPad 3
16 GB Nexus 7 (2012)
waterskier2007 is offline   0 Reply With Quote
Old Feb 7, 2013, 10:59 PM   #4
Narendar Singh
Thread Starter
macrumors member
 
Join Date: Jun 2012
Location: INDIA
Send a message via Skype™ to Narendar Singh
Working fine after following your suggested approach

Thanks
__________________
Finite Disappointment Vs Infinite Hope
Narendar Singh is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: Backing out of many view with 1 click? larswik iPhone/iPad Programming 6 Oct 5, 2012 05:27 AM
Delegate Not Called On iPad When Using Popover ahan.tm iPhone/iPad Programming 16 Sep 22, 2012 02:48 PM
How to create a Modal View Programmatically (and dismiss it) roeik iPhone/iPad Programming 10 Aug 15, 2012 02:36 PM
AppleScript To Click One Button Only If Another Button Is Unavailable JonHimself Mac Programming 2 Jul 4, 2012 12:16 PM

Forum Jump

All times are GMT -5. The time now is 08:38 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC