forked from SDWebImage/SDWebImage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDetailViewController.m
44 lines (35 loc) · 1.48 KB
/
DetailViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "DetailViewController.h"
#import <SDWebImage/SDWebImage.h>
@interface DetailViewController ()
@property (strong, nonatomic) IBOutlet SDAnimatedImageView *imageView;
@end
@implementation DetailViewController
- (void)configureView {
if (!self.imageView.sd_imageIndicator) {
self.imageView.sd_imageIndicator = SDWebImageProgressIndicator.defaultIndicator;
}
[self.imageView sd_setImageWithURL:self.imageURL
placeholderImage:nil
options:SDWebImageProgressiveLoad];
self.imageView.shouldCustomLoopCount = YES;
self.imageView.animationRepeatCount = 0;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self configureView];
self.navigationItem.rightBarButtonItem = [UIBarButtonItem.alloc initWithTitle:@"Toggle Animation"
style:UIBarButtonItemStylePlain
target:self
action:@selector(toggleAnimation:)];
}
- (void)toggleAnimation:(UIResponder *)sender {
self.imageView.isAnimating ? [self.imageView stopAnimating] : [self.imageView startAnimating];
}
@end