Эх сурвалжийг харах

Updating Example project to match AFNetworking changes

Minor bugfixes
Mattt Thompson 14 жил өмнө
parent
commit
3a4392ec43

+ 14 - 14
Example/AFNetworking Example.xcodeproj/project.pbxproj

@@ -45,7 +45,7 @@
 		F874B5D313E0AA6500B28E3E /* AFImageRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFImageRequestOperation.h; path = ../AFNetworking/AFImageRequestOperation.h; sourceTree = "<group>"; };
 		F874B5D413E0AA6500B28E3E /* AFJSONRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFJSONRequestOperation.h; path = ../AFNetworking/AFJSONRequestOperation.h; sourceTree = "<group>"; };
 		F874B5D513E0AA6500B28E3E /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworkActivityIndicatorManager.h; path = ../AFNetworking/AFNetworkActivityIndicatorManager.h; sourceTree = "<group>"; };
-		F874B5D613E0AA6500B28E3E /* AFRestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFRestClient.h; path = ../AFNetworking/AFRestClient.h; sourceTree = "<group>"; };
+		F874B5D613E0AA6500B28E3E /* AFRestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = AFRestClient.h; path = ../AFNetworking/AFRestClient.h; sourceTree = "<group>"; 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 = "<group>"; };
 		F874B5D813E0AA6500B28E3E /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImageView+AFNetworking.h"; path = "../AFNetworking/UIImageView+AFNetworking.h"; sourceTree = "<group>"; };
 		F8D25D101396A9C400CF3BD6 /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = "<group>"; };
@@ -102,13 +102,13 @@
 			path = Vendor/JSONKit;
 			sourceTree = "<group>";
 		};
-		F8D25D121396A9C400CF3BD6 /* TTT */ = {
+		F8D25D121396A9C400CF3BD6 /* FormatterKit */ = {
 			isa = PBXGroup;
 			children = (
 				F8D25D131396A9C400CF3BD6 /* TTTLocationFormatter.h */,
 				F8D25D141396A9C400CF3BD6 /* TTTLocationFormatter.m */,
 			);
-			name = TTT;
+			name = FormatterKit;
 			path = Vendor/TTT;
 			sourceTree = "<group>";
 		};
@@ -205,7 +205,7 @@
 			children = (
 				F8E469941395744600DB05C8 /* AFNetworking */,
 				F8D25D0F1396A9C400CF3BD6 /* JSONKit */,
-				F8D25D121396A9C400CF3BD6 /* TTT */,
+				F8D25D121396A9C400CF3BD6 /* FormatterKit */,
 			);
 			name = Vendor;
 			sourceTree = "<group>";
@@ -213,22 +213,22 @@
 		F8E469941395744600DB05C8 /* AFNetworking */ = {
 			isa = PBXGroup;
 			children = (
+				F874B5D113E0AA6500B28E3E /* AFHTTPRequestOperation.h */,
 				F874B5C913E0AA6500B28E3E /* AFHTTPRequestOperation.m */,
-				F874B5CA13E0AA6500B28E3E /* AFImageCache.m */,
-				F874B5CB13E0AA6500B28E3E /* AFImageRequestOperation.m */,
+				F874B5D413E0AA6500B28E3E /* AFJSONRequestOperation.h */,
 				F874B5CC13E0AA6500B28E3E /* AFJSONRequestOperation.m */,
-				F874B5CD13E0AA6500B28E3E /* AFNetworkActivityIndicatorManager.m */,
+				F874B5D613E0AA6500B28E3E /* AFRestClient.h */,
 				F874B5CE13E0AA6500B28E3E /* AFRestClient.m */,
-				F874B5CF13E0AA6500B28E3E /* UIImage+AFNetworking.m */,
-				F874B5D013E0AA6500B28E3E /* UIImageView+AFNetworking.m */,
-				F874B5D113E0AA6500B28E3E /* AFHTTPRequestOperation.h */,
-				F874B5D213E0AA6500B28E3E /* AFImageCache.h */,
 				F874B5D313E0AA6500B28E3E /* AFImageRequestOperation.h */,
-				F874B5D413E0AA6500B28E3E /* AFJSONRequestOperation.h */,
-				F874B5D513E0AA6500B28E3E /* AFNetworkActivityIndicatorManager.h */,
-				F874B5D613E0AA6500B28E3E /* AFRestClient.h */,
+				F874B5CB13E0AA6500B28E3E /* AFImageRequestOperation.m */,
+				F874B5D213E0AA6500B28E3E /* AFImageCache.h */,
+				F874B5CA13E0AA6500B28E3E /* AFImageCache.m */,
 				F874B5D713E0AA6500B28E3E /* UIImage+AFNetworking.h */,
+				F874B5CF13E0AA6500B28E3E /* UIImage+AFNetworking.m */,
 				F874B5D813E0AA6500B28E3E /* UIImageView+AFNetworking.h */,
+				F874B5D013E0AA6500B28E3E /* UIImageView+AFNetworking.m */,
+				F874B5D513E0AA6500B28E3E /* AFNetworkActivityIndicatorManager.h */,
+				F874B5CD13E0AA6500B28E3E /* AFNetworkActivityIndicatorManager.m */,
 			);
 			name = AFNetworking;
 			sourceTree = "<group>";

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 340 - 225
Example/AFNetworking Example.xcodeproj/project.xcworkspace/xcuserdata/mattt.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 16
Example/AFNetworking Example.xcodeproj/xcuserdata/mattt.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist

@@ -2,20 +2,4 @@
 <Bucket
    type = "1"
    version = "1.0">
-   <FileBreakpoints>
-      <FileBreakpoint
-         shouldBeEnabled = "No"
-         ignoreCount = "0"
-         continueAfterRunningActions = "No"
-         isPathRelative = "0"
-         filePath = "/Users/mattt/Code/Objective-C/AFNetworking/AFNetworking/AFImageRequestOperation.m"
-         timestampString = "332372128.476073"
-         startingColumnNumber = "9223372036854775807"
-         endingColumnNumber = "9223372036854775807"
-         startingLineNumber = "86"
-         endingLineNumber = "86"
-         landmarkName = "-finish"
-         landmarkType = "5">
-      </FileBreakpoint>
-   </FileBreakpoints>
 </Bucket>

+ 2 - 3
Example/Classes/Controllers/NearbySpotsViewController.h

@@ -24,10 +24,9 @@
 #import <CoreLocation/CoreLocation.h>
 
 @interface NearbySpotsViewController : UITableViewController <CLLocationManagerDelegate> {
+    NSArray *_nearbySpots;
+    CLLocationManager *_locationManager;
     UIActivityIndicatorView *_activityIndicatorView;
 }
 
-@property (readonly, nonatomic, retain) NSArray *nearbySpots;
-@property (readonly, nonatomic, retain) CLLocationManager *locationManager;
-
 @end

+ 19 - 10
Example/Classes/Controllers/NearbySpotsViewController.m

@@ -39,18 +39,11 @@
 - (void)refresh:(id)sender;
 @end
 
-static TTTLocationFormatter *__locationFormatter;
-
 @implementation NearbySpotsViewController
 @synthesize nearbySpots = _spots;
 @synthesize locationManager = _locationManager;
 @synthesize activityIndicatorView = _activityIndicatorView;
 
-+ (void)initialize {
-    __locationFormatter = [[TTTLocationFormatter alloc] init];
-    [__locationFormatter setUnitSystem:TTTImperialSystem];
-}
-
 - (id)init {
     self = [super init];
     if (!self) {
@@ -103,7 +96,7 @@ static TTTLocationFormatter *__locationFormatter;
 - (void)viewDidLoad {
     [super viewDidLoad];
     
-    self.title = NSLocalizedString(@"Nearby Spots", nil);
+    self.title = NSLocalizedString(@"AFNetworking", nil);
     
     self.activityIndicatorView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];
     self.activityIndicatorView.hidesWhenStopped = YES;
@@ -143,7 +136,7 @@ static TTTLocationFormatter *__locationFormatter;
     [self loadSpotsForLocation:newLocation];
 }
 
-#pragma mark - UITableViewDelegate
+#pragma mark - UITableViewDataSource
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
     return 1;
@@ -160,17 +153,33 @@ static TTTLocationFormatter *__locationFormatter;
     if (cell == nil) {
         cell = [[[SpotTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
     }
+    
+    static TTTLocationFormatter *_locationFormatter = nil;
+    if (!_locationFormatter) {
+        _locationFormatter = [[TTTLocationFormatter alloc] init];
+        [_locationFormatter setUnitSystem:TTTImperialSystem];
+    }
 
     Spot *spot = [self.nearbySpots objectAtIndex:indexPath.row];
     cell.textLabel.text = spot.name;
     if (self.locationManager.location) {
-        cell.detailTextLabel.text = [__locationFormatter stringFromDistanceAndBearingFromLocation:self.locationManager.location toLocation:spot.location];
+        cell.detailTextLabel.text = [_locationFormatter stringFromDistanceAndBearingFromLocation:self.locationManager.location toLocation:spot.location];
     }
     [cell.imageView setImageWithURL:[NSURL URLWithString:spot.imageURLString] placeholderImage:[UIImage imageNamed:@"placeholder-stamp.png"]];
     
     return cell;
 }
 
+#pragma mark - UITableViewDelegate
+
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+    if ([self tableView:tableView numberOfRowsInSection:section] > 0) {
+        return NSLocalizedString(@"Nearby Spots", nil);
+    }
+    
+    return nil;
+}
+
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     [tableView deselectRowAtIndexPath:indexPath animated:YES];
 }

+ 2 - 1
Example/Classes/Models/Spot.m

@@ -19,6 +19,7 @@
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
+
 #import "Spot.h"
 
 #import "AFGowallaAPIClient.h"
@@ -63,7 +64,7 @@
 		[mutableParameters setValue:[NSString stringWithFormat:@"%1.7f", location.coordinate.longitude] forKey:@"lng"];
 	}
     
-    [[AFGowallaAPIClient sharedClient] getPath:urlString parameters:mutableParameters success:^(NSDictionary *response) {
+    [[AFGowallaAPIClient sharedClient] getPath:urlString parameters:mutableParameters success:^(id response) {
         NSMutableArray *mutableRecords = [NSMutableArray array];
         for (NSDictionary *attributes in [response valueForKeyPath:@"spots"]) {
             Spot *spot = [[[Spot alloc] initWithAttributes:attributes] autorelease];

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно