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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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

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

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