[ 
https://issues.apache.org/jira/browse/CB-12467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15871547#comment-15871547
 ] 

Gabriel Fringeli commented on CB-12467:
---------------------------------------

{code:title=CDVSplashScreen.m|borderStyle=solid}

// line 99
UIView* parentView = self.viewController.view;
    parentView.userInteractionEnabled = NO;  // disable user interaction while 
splashscreen is shown
    _activityView = [[UIActivityIndicatorView alloc] 
initWithActivityIndicatorStyle:topActivityIndicatorStyle];
    //_activityView.center = CGPointMake(parentView.bounds.size.width / 2, 
parentView.bounds.size.height / 2);
    //_activityView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | 
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | 
UIViewAutoresizingFlexibleRightMargin;
    [_activityView startAnimating];

    // Set the frame & image later.
    _imageView = [[UIImageView alloc] init];
    [parentView addSubview:_imageView];

    id showSplashScreenSpinnerValue = [self.commandDelegate.settings 
objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
    // backwards compatibility - if key is missing, default to true
    if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue 
boolValue])
    {
        [_activityView setTranslatesAutoresizingMaskIntoConstraints:FALSE];
        [parentView setTranslatesAutoresizingMaskIntoConstraints:FALSE];
        [parentView addSubview:_activityView];
        NSLayoutConstraint* constraintX = [NSLayoutConstraint 
constraintWithItem:_activityView attribute:NSLayoutAttributeCenterX 
relatedBy:NSLayoutRelationEqual toItem:parentView 
attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];
        NSLayoutConstraint* constraintY = [NSLayoutConstraint 
constraintWithItem:_activityView attribute:NSLayoutAttributeCenterY 
relatedBy:NSLayoutRelationEqual toItem:parentView 
attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];
        [parentView addConstraint:constraintX];
        [parentView addConstraint:constraintY];
    }
{code}

> Activity View (Spinner) position iOS
> ------------------------------------
>
>                 Key: CB-12467
>                 URL: https://issues.apache.org/jira/browse/CB-12467
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin SplashScreen
>    Affects Versions: 4.0.1
>            Reporter: Gabriel Fringeli
>              Labels: easyfix
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> On iOS devices the current plugin version does not center the activity view 
> (Spinner) in its parent view. Instead its center is bound to the upper left 
> corner. Only after some time (5 seconds) the activity view is centered in its 
> parent view.
> I already have fixed this bug by replacing the current positioning (via 
> _activityView.center and _activityView.autoresizingMaks) with 
> NSLayoutConstraint.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to