Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orientation Issue #13

Closed
ShishirDilipkumar opened this issue Aug 18, 2011 · 2 comments
Closed

Orientation Issue #13

ShishirDilipkumar opened this issue Aug 18, 2011 · 2 comments

Comments

@ShishirDilipkumar
Copy link

PopOverController gets displaced when the orientation is changed.Is there a way to either retain its position or dismiss it when the orientation gets changed ? I've been trying hard to dismiss the popOvercontroller when the orientation changes but not able to do it.Please help me with the solution.

@gerdg
Copy link

gerdg commented Sep 12, 2011

I changed the initializer method of ActionSheetPicker to give back the created ActionPickerSheet to the UIViewController from where I create the ActionPickerSheet):

+ (ActionSheetPicker *)displayActionPickerWithView:(UIView *)aView data:(NSArray *)data selectedIndex:(NSInteger)selectedIndex target:(id)target action:(SEL)action title:(NSString *)title {
    ActionSheetPicker *actionSheetPicker = [[ActionSheetPicker alloc] initForDataWithContainingView:aView data:data selectedIndex:selectedIndex target:target action:action title:title];
    [actionSheetPicker showActionPicker];
    return [actionSheetPicker autorelease];
}

With this I can assign the created ActionPickerSheet to an ivar in my UIViewController and dismiss it in the willRotate method

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    if (self.actionSheetPicker) {
        [self.actionSheetPicker actionPickerCancel];
    }
}

Works perfect.

Regards
Gerd

@TimCinel
Copy link
Owner

gerdg's solution works.

In addition, changes to ActionSheetPicker are no longer required. The convenience function now returns a reference to the ActionSheetPicker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants