2

I need to check if the view controller is showing a modal view or not. And when a modal view is being shown, how can I intercept the "hide event" of the view controller's own view?

neural5torm
  • 773
  • 1
  • 9
  • 21
ArisRS
  • 1,362
  • 2
  • 19
  • 41

2 Answers2

4

Not sure about what "view event" you are talking about, but you can check for modalViewController property (which is deprecated in iOS 5) or presentedViewController property which is "the new black" in iOS 5.

Eimantas
  • 48,927
  • 17
  • 132
  • 168
  • Thanks I tried, it is ok. And Is it possible to show new view controller after the presented disappears? – ArisRS May 15 '12 at 12:11
  • If you want to show to consequent modal view controllers then the best place to show the second modal view controller is in the first modal view controllers `viewDidDisappear` method. – Eimantas May 15 '12 at 12:12
  • It is not possible. Because it is a 3rd party view presented on my tab bar controller – ArisRS May 15 '12 at 12:28
2

Not sure about what you ask but :

to know if you're currently a modal view check this link :

Is it possible to determine whether ViewController is presented as Modal?

and to handle "hide event" use :

- (void) viewWillDisappear:(BOOL)animated
Community
  • 1
  • 1
Damien Locque
  • 1,810
  • 2
  • 20
  • 42