-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a quick info screen to show round info.
- Loading branch information
Showing
9 changed files
with
219 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// TiltRound.h | ||
// tilt-ios | ||
// | ||
// Created by Adam Parrish on 2/11/12. | ||
// Copyright (c) 2012 Neosavvy. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface TiltRound : NSObject | ||
|
||
/* | ||
{ | ||
"_id":"4f2f0ee57221460100000001", | ||
"number":1, | ||
"updated_at":"2012-02-05T23:21:09.851Z", | ||
"created_at":"2012-02-05T23:21:09.851Z", | ||
"investor_count":0, | ||
"total_funds":0, | ||
"allocated":1000, | ||
"is_open":true, | ||
"is_current":true | ||
} | ||
*/ | ||
|
||
@property (nonatomic, strong) NSNumber *number; | ||
@property (nonatomic, strong) NSNumber *allocated; | ||
@property (nonatomic, strong) NSString *isOpen; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// TiltRound.m | ||
// tilt-ios | ||
// | ||
// Created by Adam Parrish on 2/11/12. | ||
// Copyright (c) 2012 Neosavvy. All rights reserved. | ||
// | ||
|
||
#import "TiltRound.h" | ||
|
||
@implementation TiltRound | ||
|
||
@synthesize allocated; | ||
@synthesize isOpen; | ||
@synthesize number; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// TiltRoundInfoViewController.h | ||
// tilt-ios | ||
// | ||
// Created by Adam Parrish on 2/11/12. | ||
// Copyright (c) 2012 Neosavvy. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <RestKit/RestKit.h> | ||
|
||
@interface TiltRoundInfoViewController : UIViewController <RKObjectLoaderDelegate> | ||
|
||
@property (weak, nonatomic) IBOutlet UILabel *currentRoundLabel; | ||
@property (weak, nonatomic) IBOutlet UILabel *availableCashLabel; | ||
@property (weak, nonatomic) IBOutlet UILabel *openOrClosedLabel; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// TiltRoundInfoViewController.m | ||
// tilt-ios | ||
// | ||
// Created by Adam Parrish on 2/11/12. | ||
// Copyright (c) 2012 Neosavvy. All rights reserved. | ||
// | ||
|
||
#import "TiltRoundInfoViewController.h" | ||
#import "TiltRound.h" | ||
|
||
@interface TiltRoundInfoViewController() | ||
|
||
@property (nonatomic, strong) TiltRound *round; | ||
|
||
@end | ||
|
||
@implementation TiltRoundInfoViewController | ||
@synthesize currentRoundLabel = _currentRoundLabel; | ||
@synthesize availableCashLabel = _availableCashLabel; | ||
@synthesize openOrClosedLabel = _openOrClosedLabel; | ||
|
||
@synthesize round = _round; | ||
|
||
-(TiltRound *) round | ||
{ | ||
if( _round == nil ) | ||
{ | ||
_round = [[TiltRound alloc] init]; | ||
} | ||
return _round; | ||
} | ||
|
||
- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObject:(id)object | ||
{ | ||
self.round = (TiltRound *)object; | ||
|
||
|
||
NSComparisonResult result = [@"true" compare:self.round.isOpen ]; | ||
if( result == NSOrderedSame ) | ||
{ | ||
self.currentRoundLabel.text = [NSString stringWithFormat:@"you're currently bidding on round: %@", self.round.number]; | ||
self.availableCashLabel.text = [NSString stringWithFormat:@" $%@ of $%@ ", self.round.allocated, self.round.allocated]; | ||
|
||
self.openOrClosedLabel.text = @"round is open beatches!"; | ||
} | ||
else | ||
{ | ||
self.openOrClosedLabel.text = @"pay attention to the preso! round closed"; | ||
} | ||
} | ||
|
||
- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error { | ||
NSLog(@"Encountered an error: %@", error); | ||
} | ||
|
||
-(void) viewWillAppear:(BOOL)animated | ||
{ | ||
RKObjectManager *manager = [RKObjectManager sharedManager]; | ||
[manager getObject:self.round delegate:self]; | ||
|
||
[super viewWillAppear:animated]; | ||
} | ||
|
||
- (void)viewDidUnload { | ||
[self setCurrentRoundLabel:nil]; | ||
[self setAvailableCashLabel:nil]; | ||
[self setOpenOrClosedLabel:nil]; | ||
[super viewDidUnload]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters