кто-нибудь знает, как я могу вызвать уведомление, похожее на
- (void)applicationWillTerminate:(NSNotification *)notification
, которое происходит, когда приложение завершается, но я хочу, чтобы я развернул навигационное представление.
Я полагаю, что самый простой подход здесь - реализовать UINavigationControllerDelegate, установить свой класс в качестве делегата для вашего UINavigationController и использовать
-(void)navigationController:willShowViewController:animated:
для отслеживания изменений.Вам придется написать некоторую логику, чтобы выяснить, перемещались ли вы вверх или вниз.
Например, в вашем делегате ...
-(void)navigationController:(UINavigationController *)aController<br> willShowViewController:(UIViewController *)aViewController<br> animated:(BOOL)animated<br> { if( [aViewController isKindOfClass:[MyCustomViewController class]])<br> {<br> //ive just popped or pushed the MyCustomViewController instance<br> //do something.<br> }<br> }
-(void)navigationController:(UINavigationController *)aController<br> willShowViewController:(UIViewController *)aViewController<br> animated:(BOOL)animated<br> {
if( [aViewController isKindOfClass:[MyCustomViewController class]])<br> {<br> //ive just popped or pushed the MyCustomViewController instance<br> //do something.<br> }<br> }