How to dismiss UIPopover from a button in the Popover?

Idea is simple YourViewController it's viewController of UIPopoverController MainViewController controller where you create UIPopoverController 1) Declare protocol in YourViewController with dismiss method 2) Declare property of type id delegate; } @property (nonatomic, assign) id delegate In YourViewController. M : (void) methodWhenYouWantToDismissPopover { self. Delegate dismissPopover:data; }.

Idea is simple. YourViewController - it's viewController of UIPopoverController. MainViewController - controller where you create UIPopoverController 1) Declare protocol in YourViewController with dismiss method 2) Declare property of type id in YourViewController 3) Declare support of DismissDelegateProtocol in MainViewController 4) Implement dismiss method of DismissDelegateProtocol in MainViewController 5) When you create YourViewController in MainViewController set delegate property (yourViewController.

Delegate = self;) 6) In action, that response to button touching call delegate method: self. Delegate dismissWithData:dataToTransfer; In code it should be like this: In MainViewController. H: #import "YourViewController.

H" @class MainViewController: UIViewController In MainViewController. M: - (void) dismissPopover:(NSObject *)yourDataToTransfer { /* Dismiss you popover here and process data */ } ... // Some method, when you create popover { YourViewController *vc = ... ; vc. Delegate = self; // this delegate property should be declared as assign } In YourViewController.

H: @protocol DismissPopoverDelegate - (void) dismissPopover:(NSObject *)yourDataToTransfer; @end @class YourViewController : UIViewController { id delegate; } @property (nonatomic, assign) id delegate; In YourViewController. M: - (void) methodWhenYouWantToDismissPopover { self. Delegate dismissPopover:data; }.

– Sharrp May 7 at 16:30 it says I need a ; instead in @class AddEventViewController_iPad : UIViewController – BDGapps May 7 at 16:32 what are you considering as the YourViewController. H and the MainViewController. H – BDGapps May 7 at 16:35 Look at my updated post.

YourViewController - it's viewController of UIPopoverController. MainViewController - controller where you create UIPopoverController – Sharrp May 7 at 16:42.

Sharrps answer is perfectly good, but here's a slightly different approach that may be quicker if you're presenting a subclassed view controller. So if you've subclassed the UIViewController that's being presented, define a property on it pointing to a UIPopoverController. In your presenting view controller, instantiate your custom view controller, instantiate your popover with said custom view controller, then assign the custom view controller it's property to point to the popover controller containing it.

When it comes time to dismiss, your controller has a reference to it's popover and can dismiss it. The popover will also have a pointer to it's parent view controller, so you can perform any actions you need with regards to your model via your original presenting view controller.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions