-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
159fab8
commit 8c5c35a
Showing
19 changed files
with
358 additions
and
71 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
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
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,19 @@ | ||
// | ||
// BRCDetailInfoTableViewCell.h | ||
// iBurn | ||
// | ||
// Created by Christopher Ballinger on 8/1/14. | ||
// Copyright (c) 2014 Burning Man Earth. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@class BRCDetailCellInfo; | ||
|
||
@interface BRCDetailInfoTableViewCell : UITableViewCell | ||
|
||
- (void) setDetailCellInfo:(BRCDetailCellInfo*)cellInfo; | ||
|
||
+ (NSString*)cellIdentifier; | ||
|
||
@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,85 @@ | ||
// | ||
// BRCDetailInfoTableViewself.m | ||
// iBurn | ||
// | ||
// Created by Christopher Ballinger on 8/1/14. | ||
// Copyright (c) 2014 Burning Man Earth. All rights reserved. | ||
// | ||
|
||
#import "BRCDetailInfoTableViewCell.h" | ||
#import "BRCDetailCellInfo.h" | ||
#import "BRCRelationshipDetailInfoCell.h" | ||
#import "BRCDataObject.h" | ||
#import "BRCLocationManager.h" | ||
#import "TTTLocationFormatter.h" | ||
#import "TTTTimeIntervalFormatter+iBurn.h" | ||
#import "TTTLocationFormatter+iBurn.h" | ||
|
||
@implementation BRCDetailInfoTableViewCell | ||
|
||
- (void) setSelectableAppearance { | ||
self.selectionStyle = UITableViewCellSelectionStyleDefault; | ||
self.textLabel.textColor = [UIColor blueColor]; | ||
} | ||
|
||
- (void) setPlainTextApperance { | ||
self.selectionStyle = UITableViewCellSelectionStyleNone; | ||
self.textLabel.textColor = [UIColor darkTextColor]; | ||
} | ||
|
||
- (void) setDetailCellInfo:(BRCDetailCellInfo *)cellInfo { | ||
if (!cellInfo) { | ||
return; | ||
} | ||
switch (cellInfo.cellType) { | ||
case BRCDetailCellInfoTypeDistanceFromHomeCamp: | ||
case BRCDetailCellInfoTypeDistanceFromCurrentLocation: { | ||
NSNumber *distanceNumber = cellInfo.value; | ||
CLLocationDistance distance = distanceNumber.doubleValue; | ||
if (distance > 0) { | ||
NSAttributedString *text = [TTTLocationFormatter brc_humanizedStringForDistance:distance]; | ||
self.textLabel.attributedText = text; | ||
} else { | ||
self.textLabel.text = nil; | ||
} | ||
self.selectionStyle = UITableViewCellSelectionStyleNone; | ||
break; | ||
} | ||
case BRCDetailCellInfoTypeText: { | ||
self.textLabel.text = cellInfo.value; | ||
[self setPlainTextApperance]; | ||
self.textLabel.lineBreakMode = NSLineBreakByWordWrapping; | ||
self.textLabel.numberOfLines = 0; | ||
break; | ||
} | ||
case BRCDetailCellInfoTypeEmail: { | ||
[self setSelectableAppearance]; | ||
self.textLabel.text = cellInfo.value; | ||
break; | ||
} | ||
case BRCDetailCellInfoTypeURL: { | ||
[self setSelectableAppearance]; | ||
NSURL *url = cellInfo.value; | ||
self.textLabel.text = [url absoluteString]; | ||
break; | ||
} | ||
case BRCDetailCellInfoTypeCoordinates: { | ||
CLLocation *location = cellInfo.value; | ||
self.textLabel.text = [NSString stringWithFormat:@"%f, %f", location.coordinate.latitude, location.coordinate.longitude]; | ||
[self setPlainTextApperance]; | ||
break; | ||
} | ||
case BRCDetailCellInfoTypeRelationship: { | ||
BRCRelationshipDetailInfoCell *relationshipCellInfo = (BRCRelationshipDetailInfoCell *)cellInfo; | ||
self.textLabel.text = relationshipCellInfo.dataObject.title; | ||
[self setSelectableAppearance]; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
+ (NSString*) cellIdentifier { | ||
return NSStringFromClass([self class]); | ||
} | ||
|
||
@end |
Oops, something went wrong.