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

iOS7 - contentView subview ignores center autolayout #62

Closed
llaborcz opened this issue Oct 24, 2014 · 2 comments
Closed

iOS7 - contentView subview ignores center autolayout #62

llaborcz opened this issue Oct 24, 2014 · 2 comments

Comments

@llaborcz
Copy link

On iOS7 I'm trying to add a view as a centered subview of the content view.

The auto layout is being ignored for whatever reason and the view is being added to x=0 on the contentview.

My code looks like this:

    _emptyFolderProgressDialog = [SDCAlertController alertControllerWithTitle:NSLocalizedString(@"Emptying Deleted Items", nil)
                                                                      message:nil
                                                               preferredStyle:[UIDevice isIos7] ? SDCAlertControllerStyleLegacyAlert : SDCAlertControllerStyleAlert];
    IndeterminateProgressView *progressView = [[IndeterminateProgressView alloc] initWithStyle:progressViewStylePurple];
    [progressView setTranslatesAutoresizingMaskIntoConstraints:NO];
    [progressView startAnimating];
    [_emptyFolderProgressDialog.contentView addSubview:progressView];
    [progressView sdc_horizontallyCenterInSuperview];
    [progressView sdc_verticallyCenterInSuperviewWithOffset:kProgressDialogVerticalOffset];

But what I am getting on screen is this shown below.

screen shot 2014-10-24 at 17 40 50

On iOS8 this problem does not exist, and the progress indicator is rendered in the center of the view.

@sberrevoets
Copy link
Owner

I didn't think the solution I came up with was possible at first, but I tried and didn't notice anything wrong. Please try it out, and see if this works for you.

Note: your check for iOS 7 in the preferred style is unnecessary. The controller will select the legacy style automatically on iOS 7.

@llaborcz
Copy link
Author

Thanks for the feedback - I'll give this a try next week.

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

No branches or pull requests

2 participants