Skip to content

Commit 52aa46d

Browse files
committed
Configured Pull to Refresh and added basic loading overlay to Issues table.
1 parent 4fe0229 commit 52aa46d

File tree

5 files changed

+109
-52
lines changed

5 files changed

+109
-52
lines changed

Code/Controllers/RKGHIssuesTableViewController.m

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "RKGHIssue.h"
1212
#import "RKGHIssuesTableViewController.h"
1313
#import "RKGHIssueDetailTableViewController.h"
14+
#import "RKGHLoadingView.h"
1415

1516
@interface RKGHIssuesTableViewController ()
1617
@property (nonatomic, strong) RKFetchedResultsTableController *tableController;
@@ -27,8 +28,6 @@ - (void)viewDidLoad
2728
/**
2829
Configure the RestKit table controller to drive our view
2930
*/
30-
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
31-
RKLogConfigureByName("RestKit/UI", RKLogLevelTrace);
3231
self.tableController = [[RKObjectManager sharedManager] fetchedResultsTableControllerForTableViewController:self];
3332
self.tableController.autoRefreshFromNetwork = YES;
3433
self.tableController.pullToRefreshEnabled = YES;
@@ -39,7 +38,21 @@ - (void)viewDidLoad
3938

4039
[self.tableView registerNib:[UINib nibWithNibName:@"RKGHIssueCell" bundle:nil] forCellReuseIdentifier:@"RKGHIssue"];
4140

42-
// TODO: Add a loading view...
41+
/**
42+
Configure the Pull to Refresh View
43+
*/
44+
NSBundle *restKitResources = [NSBundle restKitResourcesBundle];
45+
UIImage *arrowImage = [restKitResources imageWithContentsOfResource:@"blueArrow" withExtension:@"png"];
46+
[[RKRefreshTriggerView appearance] setTitleFont:[UIFont fontWithName:@"HelveticaNeue-Bold" size:13]];
47+
[[RKRefreshTriggerView appearance] setLastUpdatedFont:[UIFont fontWithName:@"HelveticaNeue" size:11]];
48+
[[RKRefreshTriggerView appearance] setArrowImage:arrowImage];
49+
50+
/**
51+
Configure a basic loading view
52+
*/
53+
RKGHLoadingView *loadingView = [[RKGHLoadingView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
54+
loadingView.center = self.tableView.center;
55+
self.tableController.loadingView = loadingView;
4356

4457
/**
4558
Configure our RKGHIssue -> UITableViewCell mappings. When RestKit loads the

Code/Views/RKGHLoadingView.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// RKGHLoadingView.h
3+
// RKGithub
4+
//
5+
// Created by Blake Watters on 2/24/12.
6+
// Copyright (c) 2012 RestKit. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface RKGHLoadingView : UIView
12+
13+
@end

Code/Views/RKGHLoadingView.m

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// RKGHLoadingView.m
3+
// RKGithub
4+
//
5+
// Created by Blake Watters on 2/24/12.
6+
// Copyright (c) 2012 RestKit. All rights reserved.
7+
//
8+
9+
#import <QuartzCore/QuartzCore.h>
10+
#import "RKGHLoadingView.h"
11+
12+
@interface RKGHLoadingView ()
13+
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;
14+
@end
15+
16+
@implementation RKGHLoadingView
17+
18+
@synthesize activityIndicator;
19+
20+
- (id)initWithFrame:(CGRect)frame
21+
{
22+
self = [super initWithFrame:frame];
23+
if (self) {
24+
self.backgroundColor = [UIColor grayColor];
25+
self.layer.cornerRadius = 5;
26+
self.layer.masksToBounds = YES;
27+
28+
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
29+
self.activityIndicator.hidesWhenStopped = NO;
30+
[self.activityIndicator startAnimating];
31+
[self addSubview:self.activityIndicator];
32+
self.activityIndicator.center = self.center;
33+
}
34+
return self;
35+
}
36+
37+
- (void)dealloc {
38+
[self.activityIndicator removeFromSuperview];
39+
}
40+
41+
@end

Libraries/RestKit

Submodule RestKit updated 53 files

RKGithub.xcodeproj/project.pbxproj

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@
4545
25CA7B3E14ED90AB00888FF8 /* RKGHMappingProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 25CA7B3D14ED90AA00888FF8 /* RKGHMappingProvider.m */; };
4646
25CA7B4414EDA35E00888FF8 /* RKGHPullRequestTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 25CA7B4314EDA35E00888FF8 /* RKGHPullRequestTest.m */; };
4747
25CA7B4A14EDAD4700888FF8 /* RKGHTestEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 25CA7B4914EDAD4700888FF8 /* RKGHTestEnvironment.m */; };
48-
25EC1A2214F6D63800C3CF3F /* blackArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A1A14F6D63800C3CF3F /* blackArrow.png */; };
49-
25EC1A2314F6D63800C3CF3F /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A1B14F6D63800C3CF3F /* [email protected] */; };
50-
25EC1A2414F6D63800C3CF3F /* blueArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A1C14F6D63800C3CF3F /* blueArrow.png */; };
51-
25EC1A2514F6D63800C3CF3F /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A1D14F6D63800C3CF3F /* [email protected] */; };
52-
25EC1A2614F6D63800C3CF3F /* grayArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A1E14F6D63800C3CF3F /* grayArrow.png */; };
53-
25EC1A2714F6D63800C3CF3F /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A1F14F6D63800C3CF3F /* [email protected] */; };
54-
25EC1A2814F6D63800C3CF3F /* whiteArrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A2014F6D63800C3CF3F /* whiteArrow.png */; };
55-
25EC1A2914F6D63800C3CF3F /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1A2114F6D63800C3CF3F /* [email protected] */; };
48+
25EC1B2614F8273A00C3CF3F /* RestKitResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 25EC1B2514F8273A00C3CF3F /* RestKitResources.bundle */; };
49+
25EC1B3214F8453C00C3CF3F /* RKGHLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 25EC1B3114F8453C00C3CF3F /* RKGHLoadingView.m */; };
5650
D3497A7D14F79CC1003B4794 /* NSDate+Formatting.m in Sources */ = {isa = PBXBuildFile; fileRef = D3497A7C14F79CC1003B4794 /* NSDate+Formatting.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
5751
D354A5AE14F7803B00AAA1CA /* RKGHIssueCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D300B7DB14F77B7F0054A77B /* RKGHIssueCell.m */; };
5852
D354A5AF14F7803E00AAA1CA /* RKGHIssueCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D300B7DD14F77B8F0054A77B /* RKGHIssueCell.xib */; };
@@ -101,6 +95,20 @@
10195
remoteGlobalIDString = 25160D1514564E810060A5C5;
10296
remoteInfo = RestKit;
10397
};
98+
25EC1B1614F807AC00C3CF3F /* PBXContainerItemProxy */ = {
99+
isa = PBXContainerItemProxy;
100+
containerPortal = 25CA7AE814ED694400888FF8 /* RestKit.xcodeproj */;
101+
proxyType = 1;
102+
remoteGlobalIDString = 25EC1AFE14F8078100C3CF3F;
103+
remoteInfo = RestKitResources;
104+
};
105+
25EC1B1914F807AC00C3CF3F /* PBXContainerItemProxy */ = {
106+
isa = PBXContainerItemProxy;
107+
containerPortal = 25CA7AE814ED694400888FF8 /* RestKit.xcodeproj */;
108+
proxyType = 2;
109+
remoteGlobalIDString = 25EC1AFF14F8078100C3CF3F;
110+
remoteInfo = RestKitResources;
111+
};
104112
/* End PBXContainerItemProxy section */
105113

106114
/* Begin PBXFileReference section */
@@ -157,14 +165,9 @@
157165
25CA7B4314EDA35E00888FF8 /* RKGHPullRequestTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKGHPullRequestTest.m; sourceTree = "<group>"; };
158166
25CA7B4814EDAD4700888FF8 /* RKGHTestEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKGHTestEnvironment.h; sourceTree = "<group>"; };
159167
25CA7B4914EDAD4700888FF8 /* RKGHTestEnvironment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKGHTestEnvironment.m; sourceTree = "<group>"; };
160-
25EC1A1A14F6D63800C3CF3F /* blackArrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = blackArrow.png; sourceTree = "<group>"; };
161-
25EC1A1B14F6D63800C3CF3F /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
162-
25EC1A1C14F6D63800C3CF3F /* blueArrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = blueArrow.png; sourceTree = "<group>"; };
163-
25EC1A1D14F6D63800C3CF3F /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
164-
25EC1A1E14F6D63800C3CF3F /* grayArrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grayArrow.png; sourceTree = "<group>"; };
165-
25EC1A1F14F6D63800C3CF3F /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
166-
25EC1A2014F6D63800C3CF3F /* whiteArrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = whiteArrow.png; sourceTree = "<group>"; };
167-
25EC1A2114F6D63800C3CF3F /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
168+
25EC1B2514F8273A00C3CF3F /* RestKitResources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = RestKitResources.bundle; path = ../Libraries/RestKit/RestKitResources.bundle; sourceTree = "<group>"; };
169+
25EC1B3014F8453C00C3CF3F /* RKGHLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKGHLoadingView.h; sourceTree = "<group>"; };
170+
25EC1B3114F8453C00C3CF3F /* RKGHLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKGHLoadingView.m; sourceTree = "<group>"; };
168171
D300B7DA14F77B7F0054A77B /* RKGHIssueCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKGHIssueCell.h; sourceTree = "<group>"; };
169172
D300B7DB14F77B7F0054A77B /* RKGHIssueCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKGHIssueCell.m; sourceTree = "<group>"; };
170173
D300B7DD14F77B8F0054A77B /* RKGHIssueCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RKGHIssueCell.xib; sourceTree = "<group>"; };
@@ -258,14 +261,14 @@
258261
25CA7AF514ED694400888FF8 /* RestKitTests.octest */,
259262
25CA7AF714ED694400888FF8 /* RestKit.framework */,
260263
25CA7AF914ED694400888FF8 /* RestKitFrameworkTests.octest */,
264+
25EC1B1A14F807AC00C3CF3F /* RestKitResources.bundle */,
261265
);
262266
name = Products;
263267
sourceTree = "<group>";
264268
};
265269
25CA7B1314ED77AF00888FF8 /* Code */ = {
266270
isa = PBXGroup;
267271
children = (
268-
D3497A6414F79942003B4794 /* Extensions */,
269272
25CA7B1414ED77AF00888FF8 /* Controllers */,
270273
25CA7B1A14ED77AF00888FF8 /* Models */,
271274
25CA7B1E14ED77AF00888FF8 /* Views */,
@@ -317,14 +320,16 @@
317320
D300B7DA14F77B7F0054A77B /* RKGHIssueCell.h */,
318321
D300B7DB14F77B7F0054A77B /* RKGHIssueCell.m */,
319322
D300B7DD14F77B8F0054A77B /* RKGHIssueCell.xib */,
323+
25EC1B3014F8453C00C3CF3F /* RKGHLoadingView.h */,
324+
25EC1B3114F8453C00C3CF3F /* RKGHLoadingView.m */,
320325
);
321326
path = Views;
322327
sourceTree = "<group>";
323328
};
324329
25CA7B1F14ED77AF00888FF8 /* Resources */ = {
325330
isa = PBXGroup;
326331
children = (
327-
25EC1A1914F6D63800C3CF3F /* Images */,
332+
25EC1B2514F8273A00C3CF3F /* RestKitResources.bundle */,
328333
25CA7B2014ED77AF00888FF8 /* InfoPlist.strings */,
329334
25CA7B2214ED77AF00888FF8 /* MainStoryboard.storyboard */,
330335
25CA7B2414ED77AF00888FF8 /* RKGithub-Info.plist */,
@@ -384,28 +389,6 @@
384389
path = Models;
385390
sourceTree = "<group>";
386391
};
387-
25EC1A1914F6D63800C3CF3F /* Images */ = {
388-
isa = PBXGroup;
389-
children = (
390-
25EC1A1A14F6D63800C3CF3F /* blackArrow.png */,
391-
25EC1A1B14F6D63800C3CF3F /* [email protected] */,
392-
25EC1A1C14F6D63800C3CF3F /* blueArrow.png */,
393-
25EC1A1D14F6D63800C3CF3F /* [email protected] */,
394-
25EC1A1E14F6D63800C3CF3F /* grayArrow.png */,
395-
25EC1A1F14F6D63800C3CF3F /* [email protected] */,
396-
25EC1A2014F6D63800C3CF3F /* whiteArrow.png */,
397-
25EC1A2114F6D63800C3CF3F /* [email protected] */,
398-
);
399-
path = Images;
400-
sourceTree = "<group>";
401-
};
402-
D3497A6414F79942003B4794 /* Extensions */ = {
403-
isa = PBXGroup;
404-
children = (
405-
);
406-
name = Extensions;
407-
sourceTree = "<group>";
408-
};
409392
D3497A7A14F79CB0003B4794 /* DistanceOfTimeInWords */ = {
410393
isa = PBXGroup;
411394
children = (
@@ -429,6 +412,7 @@
429412
buildRules = (
430413
);
431414
dependencies = (
415+
25EC1B1714F807AC00C3CF3F /* PBXTargetDependency */,
432416
25CA7AFB14ED695900888FF8 /* PBXTargetDependency */,
433417
);
434418
name = RKGithub;
@@ -517,23 +501,23 @@
517501
remoteRef = 25CA7AF814ED694400888FF8 /* PBXContainerItemProxy */;
518502
sourceTree = BUILT_PRODUCTS_DIR;
519503
};
504+
25EC1B1A14F807AC00C3CF3F /* RestKitResources.bundle */ = {
505+
isa = PBXReferenceProxy;
506+
fileType = wrapper.cfbundle;
507+
path = RestKitResources.bundle;
508+
remoteRef = 25EC1B1914F807AC00C3CF3F /* PBXContainerItemProxy */;
509+
sourceTree = BUILT_PRODUCTS_DIR;
510+
};
520511
/* End PBXReferenceProxy section */
521512

522513
/* Begin PBXResourcesBuildPhase section */
523514
25CA7A9B14EC7D2700888FF8 /* Resources */ = {
524515
isa = PBXResourcesBuildPhase;
525516
buildActionMask = 2147483647;
526517
files = (
518+
25EC1B2614F8273A00C3CF3F /* RestKitResources.bundle in Resources */,
527519
25CA7B3014ED78E100888FF8 /* MainStoryboard.storyboard in Resources */,
528520
25CA7B3214ED78EA00888FF8 /* InfoPlist.strings in Resources */,
529-
25EC1A2214F6D63800C3CF3F /* blackArrow.png in Resources */,
530-
25EC1A2314F6D63800C3CF3F /* [email protected] in Resources */,
531-
25EC1A2414F6D63800C3CF3F /* blueArrow.png in Resources */,
532-
25EC1A2514F6D63800C3CF3F /* [email protected] in Resources */,
533-
25EC1A2614F6D63800C3CF3F /* grayArrow.png in Resources */,
534-
25EC1A2714F6D63800C3CF3F /* [email protected] in Resources */,
535-
25EC1A2814F6D63800C3CF3F /* whiteArrow.png in Resources */,
536-
25EC1A2914F6D63800C3CF3F /* [email protected] in Resources */,
537521
D354A5AF14F7803E00AAA1CA /* RKGHIssueCell.xib in Resources */,
538522
);
539523
runOnlyForDeploymentPostprocessing = 0;
@@ -586,6 +570,7 @@
586570
25055C3214F5E83A00B9C4DD /* RKGHIssueDetailTableViewController.m in Sources */,
587571
D354A5AE14F7803B00AAA1CA /* RKGHIssueCell.m in Sources */,
588572
D3497A7D14F79CC1003B4794 /* NSDate+Formatting.m in Sources */,
573+
25EC1B3214F8453C00C3CF3F /* RKGHLoadingView.m in Sources */,
589574
);
590575
runOnlyForDeploymentPostprocessing = 0;
591576
};
@@ -615,6 +600,11 @@
615600
name = RestKit;
616601
targetProxy = 25CA7AFA14ED695900888FF8 /* PBXContainerItemProxy */;
617602
};
603+
25EC1B1714F807AC00C3CF3F /* PBXTargetDependency */ = {
604+
isa = PBXTargetDependency;
605+
name = RestKitResources;
606+
targetProxy = 25EC1B1614F807AC00C3CF3F /* PBXContainerItemProxy */;
607+
};
618608
/* End PBXTargetDependency section */
619609

620610
/* Begin PBXVariantGroup section */

0 commit comments

Comments
 (0)