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.19k
    Comment on it

    Show activity Indicator before image loads using SDWebImage SDK.

    1. UIView *myView;
    2. UIImageView *imgView;
    3. UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    4. [indicator startAnimating];
    5. [indicator setCenter:imgView.center];
    6. [imgView addSubview:indicator];
    7. NSString *imgURLStr = [[arrOfImages valueForKey:@"image"] objectAtIndex:i];
    8. [imgView setImageWithURL:[NSURL URLWithString:imgURLStr] placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
    9. [indicator removeFromSuperview];
    10. }];
    11.  
    12. [myView addSubview:imgView];

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: