Skip to content

Commit ea819b2

Browse files
author
Olivier Poitrey
committed
Rework static library settings and documentation and add an example project
Inspired by http://www.blog.montgomerie.net/easy-xcode-static-library-subprojects-and-submodules
1 parent ba71333 commit ea819b2

17 files changed

Lines changed: 1287 additions & 29 deletions

Examples/SDWebImage Demo.xcodeproj/project.pbxproj

Lines changed: 385 additions & 0 deletions
Large diffs are not rendered by default.

Examples/SDWebImage Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// AppDelegate.h
3+
// SDWebImage Demo
4+
//
5+
// Created by Olivier Poitrey on 09/05/12.
6+
// Copyright (c) 2012 Dailymotion. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
12+
13+
@property (strong, nonatomic) UIWindow *window;
14+
15+
@property (strong, nonatomic) UINavigationController *navigationController;
16+
17+
@end
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//
2+
// AppDelegate.m
3+
// SDWebImage Demo
4+
//
5+
// Created by Olivier Poitrey on 09/05/12.
6+
// Copyright (c) 2012 Dailymotion. All rights reserved.
7+
//
8+
9+
#import "AppDelegate.h"
10+
11+
#import "MasterViewController.h"
12+
13+
@implementation AppDelegate
14+
15+
@synthesize window = _window;
16+
@synthesize navigationController = _navigationController;
17+
18+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
19+
{
20+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
21+
// Override point for customization after application launch.
22+
23+
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
24+
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
25+
self.window.rootViewController = self.navigationController;
26+
[self.window makeKeyAndVisible];
27+
return YES;
28+
}
29+
30+
- (void)applicationWillResignActive:(UIApplication *)application
31+
{
32+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
33+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
34+
}
35+
36+
- (void)applicationDidEnterBackground:(UIApplication *)application
37+
{
38+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
39+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
40+
}
41+
42+
- (void)applicationWillEnterForeground:(UIApplication *)application
43+
{
44+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
45+
}
46+
47+
- (void)applicationDidBecomeActive:(UIApplication *)application
48+
{
49+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
50+
}
51+
52+
- (void)applicationWillTerminate:(UIApplication *)application
53+
{
54+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
55+
}
56+
57+
@end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// DetailViewController.h
3+
// SDWebImage Demo
4+
//
5+
// Created by Olivier Poitrey on 09/05/12.
6+
// Copyright (c) 2012 Dailymotion. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface DetailViewController : UIViewController
12+
13+
@property (strong, nonatomic) NSURL *imageURL;
14+
15+
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
16+
17+
@end
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
9+
#import "DetailViewController.h"
10+
#import <SDWebImage/UIImageView+WebCache.h>
11+
12+
@interface DetailViewController ()
13+
- (void)configureView;
14+
@end
15+
16+
@implementation DetailViewController
17+
18+
@synthesize imageURL = _imageURL;
19+
@synthesize imageView = _imageView;
20+
21+
#pragma mark - Managing the detail item
22+
23+
- (void)setImageURL:(NSURL *)imageURL
24+
{
25+
if (_imageURL != imageURL)
26+
{
27+
_imageURL = imageURL;
28+
[self configureView];
29+
}
30+
}
31+
32+
- (void)configureView
33+
{
34+
if (self.imageURL)
35+
{
36+
[self.imageView setImageWithURL:self.imageURL placeholderImage:nil options:SDWebImageProgressiveDownload];
37+
}
38+
}
39+
40+
- (void)viewDidLoad
41+
{
42+
[super viewDidLoad];
43+
[self configureView];
44+
}
45+
46+
- (void)viewDidUnload
47+
{
48+
[super viewDidUnload];
49+
self.imageView = nil;
50+
}
51+
52+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
53+
{
54+
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
55+
}
56+
57+
@end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// MasterViewController.h
3+
// SDWebImage Demo
4+
//
5+
// Created by Olivier Poitrey on 09/05/12.
6+
// Copyright (c) 2012 Dailymotion. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@class DetailViewController;
12+
13+
@interface MasterViewController : UITableViewController
14+
15+
@property (strong, nonatomic) DetailViewController *detailViewController;
16+
17+
@end
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
//
2+
// MasterViewController.m
3+
// SDWebImage Demo
4+
//
5+
// Created by Olivier Poitrey on 09/05/12.
6+
// Copyright (c) 2012 Dailymotion. All rights reserved.
7+
//
8+
9+
#import "MasterViewController.h"
10+
#import <SDWebImage/UIImageView+WebCache.h>
11+
#import "DetailViewController.h"
12+
13+
@interface MasterViewController () {
14+
NSMutableArray *_objects;
15+
}
16+
@end
17+
18+
@implementation MasterViewController
19+
20+
@synthesize detailViewController = _detailViewController;
21+
22+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
23+
{
24+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
25+
if (self)
26+
{
27+
self.title = @"SDWebImage";
28+
_objects = [NSArray arrayWithObjects:
29+
@"http://static2.dmcdn.net/static/video/451/838/44838154:jpeg_preview_small.jpg?20120509163826",
30+
@"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705",
31+
@"http://static2.dmcdn.net/static/video/629/228/44822926:jpeg_preview_small.jpg?20120509181018",
32+
@"http://static2.dmcdn.net/static/video/116/367/44763611:jpeg_preview_small.jpg?20120509101749",
33+
@"http://static2.dmcdn.net/static/video/340/086/44680043:jpeg_preview_small.jpg?20120509180118",
34+
@"http://static2.dmcdn.net/static/video/666/645/43546666:jpeg_preview_small.jpg?20120412153140",
35+
@"http://static2.dmcdn.net/static/video/771/577/44775177:jpeg_preview_small.jpg?20120509183230",
36+
@"http://static2.dmcdn.net/static/video/810/508/44805018:jpeg_preview_small.jpg?20120508125339",
37+
@"http://static2.dmcdn.net/static/video/152/008/44800251:jpeg_preview_small.jpg?20120508103336",
38+
@"http://static2.dmcdn.net/static/video/694/741/35147496:jpeg_preview_small.jpg?20120508111445",
39+
@"http://static2.dmcdn.net/static/video/988/667/44766889:jpeg_preview_small.jpg?20120508130425",
40+
@"http://static2.dmcdn.net/static/video/282/467/44764282:jpeg_preview_small.jpg?20120507130637",
41+
@"http://static2.dmcdn.net/static/video/754/657/44756457:jpeg_preview_small.jpg?20120507093012",
42+
@"http://static2.dmcdn.net/static/video/831/107/44701138:jpeg_preview_small.jpg?20120506133917",
43+
@"http://static2.dmcdn.net/static/video/411/057/44750114:jpeg_preview_small.jpg?20120507014914",
44+
@"http://static2.dmcdn.net/static/video/894/547/44745498:jpeg_preview_small.jpg?20120509183004",
45+
@"http://static2.dmcdn.net/static/video/082/947/44749280:jpeg_preview_small.jpg?20120507015022",
46+
@"http://static2.dmcdn.net/static/video/833/347/44743338:jpeg_preview_small.jpg?20120509183004",
47+
@"http://static2.dmcdn.net/static/video/683/666/44666386:jpeg_preview_small.jpg?20120505111208",
48+
@"http://static2.dmcdn.net/static/video/595/946/44649595:jpeg_preview_small.jpg?20120507194104",
49+
@"http://static2.dmcdn.net/static/video/984/935/44539489:jpeg_preview_small.jpg?20120501184650",
50+
@"http://static2.dmcdn.net/static/video/440/416/44614044:jpeg_preview_small.jpg?20120505174152",
51+
@"http://static2.dmcdn.net/static/video/561/977/20779165:jpeg_preview_small.jpg?20120423161805",
52+
@"http://static2.dmcdn.net/static/video/104/546/44645401:jpeg_preview_small.jpg?20120507185246",
53+
@"http://static2.dmcdn.net/static/video/671/636/44636176:jpeg_preview_small.jpg?20120504021339",
54+
@"http://static2.dmcdn.net/static/video/142/746/44647241:jpeg_preview_small.jpg?20120504104451",
55+
@"http://static2.dmcdn.net/static/video/776/860/44068677:jpeg_preview_small.jpg?20120507185251",
56+
@"http://static2.dmcdn.net/static/video/026/626/44626620:jpeg_preview_small.jpg?20120503203036",
57+
@"http://static2.dmcdn.net/static/video/364/663/39366463:jpeg_preview_small.jpg?20120509163505",
58+
@"http://static2.dmcdn.net/static/video/392/895/44598293:jpeg_preview_small.jpg?20120503165252",
59+
@"http://static2.dmcdn.net/static/video/620/865/44568026:jpeg_preview_small.jpg?20120507185121",
60+
@"http://static2.dmcdn.net/static/video/031/395/44593130:jpeg_preview_small.jpg?20120507185139",
61+
@"http://static2.dmcdn.net/static/video/676/495/44594676:jpeg_preview_small.jpg?20120503121341",
62+
@"http://static2.dmcdn.net/static/video/025/195/44591520:jpeg_preview_small.jpg?20120503132132",
63+
@"http://static2.dmcdn.net/static/video/993/665/44566399:jpeg_preview_small.jpg?20120503182623",
64+
@"http://static2.dmcdn.net/static/video/137/635/44536731:jpeg_preview_small.jpg?20120501165940",
65+
@"http://static2.dmcdn.net/static/video/611/794/44497116:jpeg_preview_small.jpg?20120507184954",
66+
@"http://static2.dmcdn.net/static/video/732/790/44097237:jpeg_preview_small.jpg?20120430162348",
67+
@"http://static2.dmcdn.net/static/video/064/991/44199460:jpeg_preview_small.jpg?20120430101250",
68+
@"http://static2.dmcdn.net/static/video/404/094/44490404:jpeg_preview_small.jpg?20120507184948",
69+
@"http://static2.dmcdn.net/static/video/413/120/44021314:jpeg_preview_small.jpg?20120507180850",
70+
@"http://static2.dmcdn.net/static/video/200/584/44485002:jpeg_preview_small.jpg?20120507184941",
71+
@"http://static2.dmcdn.net/static/video/551/318/42813155:jpeg_preview_small.jpg?20120412153202",
72+
@"http://static2.dmcdn.net/static/video/524/750/44057425:jpeg_preview_small.jpg?20120501220912",
73+
@"http://static2.dmcdn.net/static/video/124/843/44348421:jpeg_preview_small.jpg?20120507184551",
74+
@"http://static2.dmcdn.net/static/video/496/394/42493694:jpeg_preview_small.jpg?20120430105337",
75+
@"http://static2.dmcdn.net/static/video/548/883/44388845:jpeg_preview_small.jpg?20120428212713",
76+
@"http://static2.dmcdn.net/static/video/282/533/44335282:jpeg_preview_small.jpg?20120427102844",
77+
@"http://static2.dmcdn.net/static/video/257/132/44231752:jpeg_preview_small.jpg?20120428212609",
78+
@"http://static2.dmcdn.net/static/video/480/193/44391084:jpeg_preview_small.jpg?20120501143214",
79+
@"http://static2.dmcdn.net/static/video/903/432/44234309:jpeg_preview_small.jpg?20120427200002",
80+
@"http://static2.dmcdn.net/static/video/646/573/44375646:jpeg_preview_small.jpg?20120507184652",
81+
@"http://static2.dmcdn.net/static/video/709/573/44375907:jpeg_preview_small.jpg?20120507184652",
82+
@"http://static2.dmcdn.net/static/video/885/633/44336588:jpeg_preview_small.jpg?20120507184540",
83+
@"http://static2.dmcdn.net/static/video/732/523/44325237:jpeg_preview_small.jpg?20120426110308",
84+
@"http://static2.dmcdn.net/static/video/935/132/44231539:jpeg_preview_small.jpg?20120426115744",
85+
@"http://static2.dmcdn.net/static/video/941/129/43921149:jpeg_preview_small.jpg?20120426094640",
86+
@"http://static2.dmcdn.net/static/video/775/942/44249577:jpeg_preview_small.jpg?20120425011228",
87+
@"http://static2.dmcdn.net/static/video/868/332/44233868:jpeg_preview_small.jpg?20120429152901",
88+
@"http://static2.dmcdn.net/static/video/959/732/44237959:jpeg_preview_small.jpg?20120425133534",
89+
@"http://static2.dmcdn.net/static/video/383/402/44204383:jpeg_preview_small.jpg?20120424185842",
90+
@"http://static2.dmcdn.net/static/video/971/932/44239179:jpeg_preview_small.jpg?20120424154419",
91+
@"http://static2.dmcdn.net/static/video/096/991/44199690:jpeg_preview_small.jpg?20120423162001",
92+
@"http://static2.dmcdn.net/static/video/661/450/44054166:jpeg_preview_small.jpg?20120507180921",
93+
@"http://static2.dmcdn.net/static/video/419/322/44223914:jpeg_preview_small.jpg?20120424112858",
94+
@"http://static2.dmcdn.net/static/video/673/391/44193376:jpeg_preview_small.jpg?20120507181450",
95+
@"http://static2.dmcdn.net/static/video/907/781/44187709:jpeg_preview_small.jpg?20120423103507",
96+
@"http://static2.dmcdn.net/static/video/446/571/44175644:jpeg_preview_small.jpg?20120423033122",
97+
@"http://static2.dmcdn.net/static/video/146/671/44176641:jpeg_preview_small.jpg?20120428235503",
98+
@"http://static2.dmcdn.net/static/video/463/571/44175364:jpeg_preview_small.jpg?20120428235503",
99+
@"http://static2.dmcdn.net/static/video/442/471/44174244:jpeg_preview_small.jpg?20120428235502",
100+
@"http://static2.dmcdn.net/static/video/523/471/44174325:jpeg_preview_small.jpg?20120422205107",
101+
@"http://static2.dmcdn.net/static/video/977/159/43951779:jpeg_preview_small.jpg?20120420182100",
102+
@"http://static2.dmcdn.net/static/video/875/880/40088578:jpeg_preview_small.jpg?20120501131026",
103+
@"http://static2.dmcdn.net/static/video/434/992/38299434:jpeg_preview_small.jpg?20120503193356",
104+
@"http://static2.dmcdn.net/static/video/448/798/42897844:jpeg_preview_small.jpg?20120418155203",
105+
@"http://static2.dmcdn.net/static/video/374/690/44096473:jpeg_preview_small.jpg?20120507181124",
106+
@"http://static2.dmcdn.net/static/video/284/313/43313482:jpeg_preview_small.jpg?20120420184511",
107+
@"http://static2.dmcdn.net/static/video/682/060/44060286:jpeg_preview_small.jpg?20120421122436",
108+
@"http://static2.dmcdn.net/static/video/701/750/44057107:jpeg_preview_small.jpg?20120420112918",
109+
@"http://static2.dmcdn.net/static/video/790/850/44058097:jpeg_preview_small.jpg?20120424114522",
110+
@"http://static2.dmcdn.net/static/video/153/617/43716351:jpeg_preview_small.jpg?20120419190650",
111+
@"http://static2.dmcdn.net/static/video/394/633/37336493:jpeg_preview_small.jpg?20111109151109",
112+
@"http://static2.dmcdn.net/static/video/893/330/44033398:jpeg_preview_small.jpg?20120419123322",
113+
@"http://static2.dmcdn.net/static/video/395/046/42640593:jpeg_preview_small.jpg?20120418103546",
114+
@"http://static2.dmcdn.net/static/video/913/040/44040319:jpeg_preview_small.jpg?20120419164908",
115+
@"http://static2.dmcdn.net/static/video/090/020/44020090:jpeg_preview_small.jpg?20120418185934",
116+
@"http://static2.dmcdn.net/static/video/349/299/43992943:jpeg_preview_small.jpg?20120418112749",
117+
@"http://static2.dmcdn.net/static/video/530/189/43981035:jpeg_preview_small.jpg?20120419013834",
118+
@"http://static2.dmcdn.net/static/video/763/469/43964367:jpeg_preview_small.jpg?20120425111931",
119+
@"http://static2.dmcdn.net/static/video/961/455/43554169:jpeg_preview_small.jpg?20120418110127",
120+
@"http://static2.dmcdn.net/static/video/666/889/43988666:jpeg_preview_small.jpg?20120507180735",
121+
@"http://static2.dmcdn.net/static/video/160/459/43954061:jpeg_preview_small.jpg?20120501202847",
122+
@"http://static2.dmcdn.net/static/video/352/069/43960253:jpeg_preview_small.jpg?20120503175747",
123+
@"http://static2.dmcdn.net/static/video/096/502/43205690:jpeg_preview_small.jpg?20120417142655",
124+
@"http://static2.dmcdn.net/static/video/257/119/43911752:jpeg_preview_small.jpg?20120416101238",
125+
@"http://static2.dmcdn.net/static/video/874/098/43890478:jpeg_preview_small.jpg?20120415193608",
126+
@"http://static2.dmcdn.net/static/video/406/148/43841604:jpeg_preview_small.jpg?20120416123145",
127+
@"http://static2.dmcdn.net/static/video/463/885/43588364:jpeg_preview_small.jpg?20120409130206",
128+
@"http://static2.dmcdn.net/static/video/176/845/38548671:jpeg_preview_small.jpg?20120414200742",
129+
nil];
130+
}
131+
return self;
132+
}
133+
134+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
135+
{
136+
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
137+
}
138+
139+
#pragma mark - Table View
140+
141+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
142+
{
143+
return 1;
144+
}
145+
146+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
147+
{
148+
return _objects.count;
149+
}
150+
151+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
152+
{
153+
static NSString *CellIdentifier = @"Cell";
154+
155+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
156+
if (cell == nil)
157+
{
158+
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
159+
}
160+
161+
cell.textLabel.text = [NSString stringWithFormat:@"Image #%d", indexPath.row];
162+
[cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]]
163+
placeholderImage:[UIImage imageNamed:@"placeholder"]];
164+
return cell;
165+
}
166+
167+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
168+
{
169+
if (!self.detailViewController)
170+
{
171+
self.detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
172+
}
173+
NSString *largeImageURL = [[_objects objectAtIndex:indexPath.row] stringByReplacingOccurrencesOfString:@"small" withString:@"source"];
174+
self.detailViewController.imageURL = [NSURL URLWithString:largeImageURL];
175+
[self.navigationController pushViewController:self.detailViewController animated:YES];
176+
}
177+
178+
@end

0 commit comments

Comments
 (0)