Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to show ActivityIndicator before image load in iPhone

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.18k
    Comment on it

    Show activity Indicator before image loads using SDWebImage SDK.

    UIView *myView;
    UIImageView *imgView;
    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        [indicator startAnimating];
        [indicator setCenter:imgView.center];
        [imgView addSubview:indicator];
        NSString *imgURLStr = [[arrOfImages valueForKey:@"image"] objectAtIndex:i];
        [imgView setImageWithURL:[NSURL URLWithString:imgURLStr] placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
            [indicator removeFromSuperview];
        }];
    
        [myView addSubview:imgView];
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: