samedi 1 août 2015

UIIndicatorView not shown in the landscape mode?

I am showing a UIIndicatorView in portrait mode when i rotate the screen into landscape mode it does not show.

Code for moving screen into landscape mode

NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];

code for showing activity indicator

-(void)activityIndicator:(NSString *)show
{
    if([show isEqual:@"show"])
    {

       [[UIApplication sharedApplication] beginIgnoringInteractionEvents];

        [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
        activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        activityView.layer.backgroundColor = [[UIColor colorWithWhite:0.0f alpha:0.5f] CGColor];
        activityView.hidesWhenStopped = YES;
        activityView.frame = self.view.bounds;
        [self.view addSubview:activityView];
        [activityView startAnimating];

        if(IS_IPHONE_5)
        {
            loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 270, 100, 100)];
        }
        else if(IS_IPHONE_6)
        {
            loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(140, 320, 100, 100)];
        }
        loadingLabel.backgroundColor = [UIColor clearColor];
        loadingLabel.textColor = [UIColor whiteColor];
        loadingLabel.adjustsFontSizeToFitWidth = YES;
        loadingLabel.textAlignment = NSTextAlignmentCenter;
        loadingLabel.text = @"Loading...";
        [self.view addSubview:loadingLabel];
    }
    else
    {
        [[UIApplication sharedApplication] endIgnoringInteractionEvents];
        [activityView stopAnimating];
        [activityView removeFromSuperview];
        [loadingLabel removeFromSuperview];
    }
}

Aucun commentaire:

Enregistrer un commentaire