mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Moved some items around, knocking down todo's
This commit is contained in:
@@ -53,7 +53,6 @@
|
||||
|
||||
[[TTNavigator navigator].URLMap from:@"db://updateAttachment" toObject:self selector:@selector(updateAttachment)];
|
||||
|
||||
// TODO: Use self.post method?
|
||||
if (nil == _post) {
|
||||
_post = [[DBPost object] retain];
|
||||
_post.topicID = _topicID;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#import "DBManagedObjectCache.h"
|
||||
#import "DBUser.h"
|
||||
|
||||
// TODO: Move me somewhere else...
|
||||
@implementation UINavigationBar (CustomImage)
|
||||
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
@@ -25,14 +24,17 @@
|
||||
- (void)loadView {
|
||||
[super loadView];
|
||||
|
||||
// TODO: Make this cleaner...
|
||||
// Background styling
|
||||
UIImageView* backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]];
|
||||
[self.navigationController.view addSubview:backgroundImage];
|
||||
[self.navigationController.view sendSubviewToBack:backgroundImage];
|
||||
[self.view setBackgroundColor:[UIColor clearColor]];
|
||||
[self.tableView setBackgroundColor:[UIColor clearColor]];
|
||||
|
||||
UIView* tableHeaderView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 31)] autorelease];
|
||||
[backgroundImage release];
|
||||
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
|
||||
// Setup the Table Header
|
||||
UIView* tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 31)];
|
||||
UIImageView* headerBackgroundImage = [[UIImageView alloc] initWithFrame:tableHeaderView.frame];
|
||||
[headerBackgroundImage setImage:[UIImage imageNamed:@"tableHeaderBackground.png"]];
|
||||
[tableHeaderView addSubview:headerBackgroundImage];
|
||||
@@ -42,14 +44,19 @@
|
||||
_loadedAtLabel.backgroundColor = [UIColor clearColor];
|
||||
_loadedAtLabel.textColor = [UIColor colorWithRed:0.53 green:0.56 blue:0.60 alpha:1];
|
||||
[tableHeaderView addSubview:_loadedAtLabel];
|
||||
|
||||
UIButton* reloadButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[reloadButton setImage:[UIImage imageNamed:@"reload.png"] forState:UIControlStateNormal];
|
||||
[reloadButton setFrame:CGRectMake(131, 0, 82, 23)];
|
||||
[reloadButton addTarget:self action:@selector(reloadButtonWasPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[reloadButton addTarget:self action:@selector(invalidateModel) forControlEvents:UIControlEventTouchUpInside];
|
||||
[tableHeaderView addSubview:reloadButton];
|
||||
|
||||
[self.view addSubview:tableHeaderView];
|
||||
[tableHeaderView release];
|
||||
|
||||
UIView* tableSpacer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 31)];
|
||||
self.tableView.tableHeaderView = tableSpacer;
|
||||
[tableSpacer release];
|
||||
|
||||
// Register for notifications. We reload the interface when authentication state changes
|
||||
// or the object graph is manipulated
|
||||
@@ -58,10 +65,6 @@
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(invalidateModel) name:kObjectCreatedUpdatedOrDestroyedNotificationName object:nil];
|
||||
}
|
||||
|
||||
- (void)reloadButtonWasPressed:(id)sender {
|
||||
[self invalidateModel];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[super viewDidUnload];
|
||||
|
||||
@@ -69,12 +72,10 @@
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
// TODO: Why not use a createResourcePath method instead of an ivar?
|
||||
- (void)createModel {
|
||||
self.model = [[[RKRequestTTModel alloc] initWithResourcePath:_resourcePath] autorelease];
|
||||
}
|
||||
|
||||
// TODO: Comment me up!
|
||||
- (void)didLoadModel:(BOOL)firstTime {
|
||||
[super didLoadModel:firstTime];
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <RestKit/RestKit.h>
|
||||
|
||||
// TODO: Why not move this into a controller and inherit instead of using categories?
|
||||
@interface UIViewController (RKLoading) <RKRequestDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@@ -37,6 +37,7 @@ static NSInteger const kProgressViewTag = 67;
|
||||
progressView.tag = kProgressViewTag;
|
||||
[self.view addSubview:progressView];
|
||||
}
|
||||
|
||||
progressView.progress = totalBytesWritten / (float)totalBytesExpectedToWrite;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,14 +54,11 @@
|
||||
|
||||
/**
|
||||
* The numeric primary key to the Topic this Post was made to
|
||||
*
|
||||
* TODO: This is the primary key, used in the automatic primary key association. Document it.
|
||||
*/
|
||||
@property (nonatomic, retain) NSNumber* topicID;
|
||||
|
||||
/**
|
||||
* The numeric primary key to the User this Post was created by
|
||||
* TODO: Create relationship and document
|
||||
*/
|
||||
@property (nonatomic, retain) NSNumber* userID;
|
||||
|
||||
|
||||
@@ -85,9 +85,10 @@
|
||||
* in your payloads.
|
||||
*/
|
||||
- (NSObject<RKRequestSerializable>*)paramsForSerialization {
|
||||
// TODO: Should I expose the default super-class method as a dictionary returning method for clarity??
|
||||
NSDictionary* attributes = (NSDictionary*) [super paramsForSerialization];
|
||||
RKParams* params = [RKParams paramsWithDictionary:attributes];
|
||||
// TODO: This is broken!
|
||||
// TODO: The Rails router does not respect paramsForSerialization. Need to fix that!
|
||||
RKParams* params = [RKParams params];
|
||||
[params setValue:self.body forParam:@"body"];
|
||||
NSLog(@"Self Body: %@", self.body);
|
||||
if (_newAttachment) {
|
||||
NSData* data = UIImagePNGRepresentation(_newAttachment);
|
||||
|
||||
@@ -460,8 +460,8 @@
|
||||
3F3239E012DBB9C600AB2F6E /* DBPostTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBPostTableViewController.m; sourceTree = "<group>"; };
|
||||
3F3239EB12DBBA8D00AB2F6E /* DBAuthenticatedTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBAuthenticatedTableViewController.h; sourceTree = "<group>"; };
|
||||
3F3239EC12DBBA8D00AB2F6E /* DBAuthenticatedTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBAuthenticatedTableViewController.m; sourceTree = "<group>"; };
|
||||
3F49C15912DE1D9900FDE614 /* RKRequestTTModel+Loading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RKRequestTTModel+Loading.h"; sourceTree = "<group>"; };
|
||||
3F49C15A12DE1D9900FDE614 /* RKRequestTTModel+Loading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RKRequestTTModel+Loading.m"; sourceTree = "<group>"; };
|
||||
3F49C15912DE1D9900FDE614 /* RKRequestTTModel+Loading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "RKRequestTTModel+Loading.h"; path = "Other/RKRequestTTModel+Loading.h"; sourceTree = "<group>"; };
|
||||
3F49C15A12DE1D9900FDE614 /* RKRequestTTModel+Loading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "RKRequestTTModel+Loading.m"; path = "Other/RKRequestTTModel+Loading.m"; sourceTree = "<group>"; };
|
||||
3F76BBD512D7DA9D001562DC /* DataModel.xcdatamodel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.xcdatamodel; name = DataModel.xcdatamodel; path = Resources/DataModel.xcdatamodel; sourceTree = "<group>"; };
|
||||
8D1107310486CEB800E47090 /* DiscussionBoard-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DiscussionBoard-Info.plist"; path = "Resources/DiscussionBoard-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
|
||||
A755037712E4CBD4009FC5EC /* icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-114.png"; path = "Resources/PNGs/app_icon/icon-114.png"; sourceTree = SOURCE_ROOT; };
|
||||
@@ -528,8 +528,7 @@
|
||||
3F255C9112DB70E200AFD2D1 /* Controllers */,
|
||||
25359EC912E51057008BF33D /* Other */,
|
||||
);
|
||||
name = Code;
|
||||
path = Classes;
|
||||
path = Code;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
@@ -926,6 +925,8 @@
|
||||
25359EC912E51057008BF33D /* Other */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3F49C15912DE1D9900FDE614 /* RKRequestTTModel+Loading.h */,
|
||||
3F49C15A12DE1D9900FDE614 /* RKRequestTTModel+Loading.m */,
|
||||
25359ED512E512BB008BF33D /* DiscussionBoard_Prefix.pch */,
|
||||
25359ED612E512BB008BF33D /* main.m */,
|
||||
25359ECA12E51070008BF33D /* DBEnvironment.h */,
|
||||
@@ -1010,8 +1011,6 @@
|
||||
3F255C9F12DB70E700AFD2D1 /* DBTopic.m */,
|
||||
3F255CA612DB711900AFD2D1 /* DBUser.h */,
|
||||
3F255CA712DB711900AFD2D1 /* DBUser.m */,
|
||||
3F49C15912DE1D9900FDE614 /* RKRequestTTModel+Loading.h */,
|
||||
3F49C15A12DE1D9900FDE614 /* RKRequestTTModel+Loading.m */,
|
||||
);
|
||||
name = Models;
|
||||
path = ../Code/Models;
|
||||
|
||||
Reference in New Issue
Block a user