开发者

When should I set my view's delegate as nil?

开发者 https://www.devze.com 2023-02-18 05:21 出处:网络
I have a modal view controller which is used for entering data in my iPhone开发者_Go百科 app. I am trying to be efficient by using the same view controller every time there is data to be added, so thi

I have a modal view controller which is used for entering data in my iPhone开发者_Go百科 app. I am trying to be efficient by using the same view controller every time there is data to be added, so this one view controller can get called from various different parent views.

Whichever parent view calls the "addingViewController" gets set as its delegate, so I assume before I pop the modal view I need to do a "self.delegate = nil", to make sure that I don't accidentally end up with 2 delegates at the same time.

Am I right that I need to do a "self.delegate = nil"? Which is the appropriate method to do this in - is it viewWillDisappear?

Thanks.


I think when the new delegate is assigned, it knocks out the old delegate, like any other assignment would. So you probably don't have to worry about setting the delegate to nil first.

0

精彩评论

暂无评论...
验证码 换一张
取 消