DetailViewController.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // DetailViewController.m
  3. // SDWebImage Demo
  4. //
  5. // Created by Olivier Poitrey on 09/05/12.
  6. // Copyright (c) 2012 Dailymotion. All rights reserved.
  7. //
  8. #import "DetailViewController.h"
  9. #import <SDWebImage/UIImageView+WebCache.h>
  10. @interface DetailViewController ()
  11. - (void)configureView;
  12. @end
  13. @implementation DetailViewController
  14. @synthesize imageURL = _imageURL;
  15. @synthesize imageView = _imageView;
  16. #pragma mark - Managing the detail item
  17. - (void)setImageURL:(NSURL *)imageURL
  18. {
  19. if (_imageURL != imageURL)
  20. {
  21. _imageURL = imageURL;
  22. [self configureView];
  23. }
  24. }
  25. - (void)configureView
  26. {
  27. if (self.imageURL)
  28. {
  29. [self.imageView setImageWithURL:self.imageURL placeholderImage:nil options:SDWebImageProgressiveDownload];
  30. }
  31. }
  32. - (void)viewDidLoad
  33. {
  34. [super viewDidLoad];
  35. [self configureView];
  36. }
  37. - (void)viewDidUnload
  38. {
  39. [super viewDidUnload];
  40. self.imageView = nil;
  41. }
  42. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  43. {
  44. return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
  45. }
  46. @end