Search code examples
iphoneiosuiactionsheet

Dismiss UIActionSheet before device rotate?


In portaint Actionsheet show in tabbar. In landscape - in window. I heed do remove UIActionSheet from tabbar before rotate, for after rotate show in wondow. Inside – willRotateToInterfaceOrientation:duration dismiss action sheet dont work.


Solution

  • You can use NSNotification for this. Add this notifier in your viewdidload file you willl get notify when orientation is going to change:

    [[NSNotificationCenter defaultCenter] addObserver:self 
        selector:@selector(OrientationChanged:) 
        name:@"UIDeviceOrientationDidChangeNotification"
        object:nil];
    

    …add this method:

    -(void)OrientationChanged
    {
    
    }
    

    See NSNotification class reference.