当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - Close popup UITableViewController view

问题描述:

How do I know when the view got closed? Am currently using the delegate pattern, capture viewDidDisappear to fire the event... Is this the correct one to use? Downside of viewDidDisappear is that when my view move to a sub-view the event still fires.

Its a custom view that i made that exptend UITableViewController... In that table you got a list of options that you manage, so when moving between those screens I don't want my event to fire.. I only want it to fire when I close the actual view.

网友答案:

now just see when your UITableView begin open at that time you set the bool value like...

first define this variable global in your .h file like bellow

BOOL isTableOpen;

and after that in your .m file

set yes when your tableview is open with button tap event or anything else which you used...

isTableOpen = YES;

after when your pop-up view or UITableview closed at that time set value NO like

isTableOpen = NO;

and check in your viewDidDisappear: that if isTableOpen is true then do nothing otherwise yes...

-(void)viewDidDisappear:(BOOL)animated{
    if(isTableOpen){
       //call your method which you want...
    }
}

i hope this help you or get some Idea ..

:)

分享给朋友:
您可能感兴趣的文章:
随机阅读: