diff --git a/Example/AFNetworking Example.xcodeproj/project.pbxproj b/Example/AFNetworking Example.xcodeproj/project.pbxproj index b61798d..6b71fb1 100644 --- a/Example/AFNetworking Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking Example.xcodeproj/project.pbxproj @@ -58,6 +58,7 @@ F874B5D613E0AA6500B28E3E /* AFRestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = AFRestClient.h; path = ../AFNetworking/AFRestClient.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; F874B5D713E0AA6500B28E3E /* UIImage+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+AFNetworking.h"; path = "../AFNetworking/UIImage+AFNetworking.h"; sourceTree = ""; }; F874B5D813E0AA6500B28E3E /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImageView+AFNetworking.h"; path = "../AFNetworking/UIImageView+AFNetworking.h"; sourceTree = ""; }; + F8870C3D1424409800BCD863 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; F8D25D101396A9C400CF3BD6 /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = ""; }; F8D25D111396A9C400CF3BD6 /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = ""; }; F8D25D131396A9C400CF3BD6 /* TTTLocationFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTTLocationFormatter.h; sourceTree = ""; }; @@ -174,6 +175,7 @@ F8E469551395739C00DB05C8 = { isa = PBXGroup; children = ( + F8870C3D1424409800BCD863 /* QuartzCore.framework */, F8E469B71395759C00DB05C8 /* Networking Extensions */, F8E4696A1395739D00DB05C8 /* Classes */, F8E469ED1395812A00DB05C8 /* Images */, diff --git a/Example/AFNetworking Example.xcodeproj/xcuserdata/mattt.xcuserdatad/xcschemes/AFNetworking Example.xcscheme b/Example/AFNetworking Example.xcodeproj/xcuserdata/mattt.xcuserdatad/xcschemes/AFNetworking Example.xcscheme index 0f592ba..a8639b4 100644 --- a/Example/AFNetworking Example.xcodeproj/xcuserdata/mattt.xcuserdatad/xcschemes/AFNetworking Example.xcscheme +++ b/Example/AFNetworking Example.xcodeproj/xcuserdata/mattt.xcuserdatad/xcschemes/AFNetworking Example.xcscheme @@ -1,6 +1,6 @@ + version = "1.8"> @@ -36,7 +36,9 @@ displayScale = "1.00" launchStyle = "0" useCustomWorkingDirectory = "NO" - buildConfiguration = "Debug"> + buildConfiguration = "Debug" + debugDocumentVersioning = "YES" + allowLocationSimulation = "YES"> + + + buildConfiguration = "Release" + debugDocumentVersioning = "YES"> +@class Spot; + @interface SpotTableViewCell : UITableViewCell +@property (nonatomic, retain) Spot *spot; + @end diff --git a/Example/Classes/Views/SpotTableViewCell.m b/Example/Classes/Views/SpotTableViewCell.m index 5ecb303..5de7eb1 100644 --- a/Example/Classes/Views/SpotTableViewCell.m +++ b/Example/Classes/Views/SpotTableViewCell.m @@ -22,7 +22,12 @@ #import "SpotTableViewCell.h" +#import "Spot.h" + +#import "UIImageView+AFNetworking.h" + @implementation SpotTableViewCell +@synthesize spot = _spot; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; @@ -32,35 +37,63 @@ self.textLabel.textColor = [UIColor darkGrayColor]; self.textLabel.numberOfLines = 2; + self.textLabel.backgroundColor = self.backgroundColor; self.detailTextLabel.textColor = [UIColor grayColor]; + self.detailTextLabel.backgroundColor = self.backgroundColor; + + self.imageView.backgroundColor = self.backgroundColor; self.selectionStyle = UITableViewCellSelectionStyleGray; return self; } -#pragma mark - UIView - -- (void)layoutSubviews { - [super layoutSubviews]; - - CGRect imageViewFrame = self.imageView.frame; - CGRect textLabelFrame = self.textLabel.frame; - CGRect detailTextLabelFrame = self.detailTextLabel.frame; - - imageViewFrame.origin = CGPointMake(10.0f, 10.0f); - imageViewFrame.size = CGSizeMake(50.0f, 50.0f); - - textLabelFrame.origin.x = imageViewFrame.size.width + 25.0f; - detailTextLabelFrame.origin.x = textLabelFrame.origin.x; - - textLabelFrame.size.width = 240.0f; - detailTextLabelFrame.size.width = textLabelFrame.size.width; - - self.textLabel.frame = textLabelFrame; - self.detailTextLabel.frame = detailTextLabelFrame; - self.imageView.frame = imageViewFrame; +- (void)dealloc { + [_spot release]; + [super dealloc]; } +- (void)setSpot:(Spot *)spot { + [self willChangeValueForKey:@"spot"]; + [_spot autorelease]; + _spot = [spot retain]; + [self didChangeValueForKey:@"spot"]; + + [self.imageView setImageWithURL:[NSURL URLWithString:self.spot.imageURLString] placeholderImage:[UIImage imageNamed:@"placeholder-stamp.png"]]; + + self.textLabel.text = spot.name; +} + +#pragma mark - UITableViewCell + +- (void)prepareForReuse { + [self.imageView cancelImageRequestOperation]; + self.textLabel.text = nil; + self.detailTextLabel.text = nil; +} + +#pragma mark - UIView + +//- (void)layoutSubviews { +// [super layoutSubviews]; +// +// CGRect imageViewFrame = self.imageView.frame; +// CGRect textLabelFrame = self.textLabel.frame; +// CGRect detailTextLabelFrame = self.detailTextLabel.frame; +// +// imageViewFrame.origin = CGPointMake(10.0f, 10.0f); +// imageViewFrame.size = CGSizeMake(50.0f, 50.0f); +// +// textLabelFrame.origin.x = imageViewFrame.size.width + 25.0f; +// detailTextLabelFrame.origin.x = textLabelFrame.origin.x; +// +// textLabelFrame.size.width = 240.0f; +// detailTextLabelFrame.size.width = textLabelFrame.size.width; +// +// self.textLabel.frame = textLabelFrame; +// self.detailTextLabel.frame = detailTextLabelFrame; +// self.imageView.frame = CGRectIntegral(imageViewFrame); +//} + @end