-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMAEventViewCell.m
94 lines (79 loc) · 3.22 KB
/
MAEventViewCell.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// MAFeedViewCell.m
// Mundi
//
// Created by Tyler Hedrick on 1/25/13.
// Copyright (c) 2013 hedrick.tyler. All rights reserved.
//
#import "MAEventViewCell.h"
@implementation MAEventViewCell
@synthesize eventDetails, eventTitle, timeLabel, eventDate, object;
- (id)init
{
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"EventCell"];
if (self) {
eventTitle = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 200, 25)];
eventDate = [[UILabel alloc] initWithFrame:CGRectMake(5, 27, 150, 25)];
eventDetails = [[UILabel alloc] initWithFrame:CGRectMake(5, 50, 260, 25)];
timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 5, 100, 40)];
}
return self;
}
- (void)setObject:(PFObject *)obj
{
object = obj;
[self setupLabels];
}
- (void)setupLabels
{
UIFont *titleFont = [UIFont fontWithName:@"DroidSans" size:18];
UIFont *detailsFont = [UIFont fontWithName:@"DroidSans" size:12];
UIFont *dateFont = [UIFont fontWithName:@"DroidSans" size:16];
UIFont *timeFont = [UIFont fontWithName:@"DroidSans" size:36];
UIColor *regularColor = [UIColor colorWithWhite:0.3 alpha:1];
UIColor *poppy = [UIColor colorWithRed:(248/255.0f) green:(102/255.0f) blue:(41/255.0f) alpha:1];
UIColor *turquoise = [UIColor colorWithRed:(0/255.0f) green:(200/255.0f) blue:(184/255.0f) alpha:1];
UIColor *blue = [UIColor colorWithRed:(85/255.0f) green:(95/255.0f) blue:(255/255.0f) alpha:1];
UIColor *red = [UIColor colorWithRed:(190/255.0f) green:(0/255.0f) blue:(0/255.0f) alpha:1];
// Title
[eventTitle setText:[object objectForKey:@"name"]];
[eventTitle setBackgroundColor:[UIColor clearColor]];
[eventTitle setTextColor:regularColor];
[eventTitle setFont:titleFont];
// Details
[eventDetails setText:[object objectForKey:@"details"]];
[eventDetails setBackgroundColor:[UIColor clearColor]];
[eventDetails setTextColor:regularColor];
[eventDetails setFont:detailsFont];
// Date
NSString *date = [object objectForKey:@"date"];
[eventDate setText:date];
[eventDate setBackgroundColor:[UIColor clearColor]];
[eventDate setTextColor:regularColor];
[eventDate setFont:dateFont];
// Time
[timeLabel setText:[object objectForKey:@"time"]];
[timeLabel setBackgroundColor:[UIColor clearColor]];
[timeLabel setFont:timeFont];
[timeLabel setTextColor:poppy];
NSString *eventCategory = [object objectForKey:@"category"];
if([eventCategory isEqualToString:@"Food & Drink"]){
[timeLabel setTextColor:poppy];
} else if([eventCategory isEqualToString:@"Chill"]){
[timeLabel setTextColor:turquoise];
} else if([eventCategory isEqualToString:@"Adventure"]){
[timeLabel setTextColor:blue];
} else if([eventCategory isEqualToString:@"Outdoors"]) {
[timeLabel setTextColor:red];
}
[self.contentView addSubview:eventTitle];
[self.contentView addSubview:eventDetails];
[self.contentView addSubview:eventDate];
[self.contentView addSubview:timeLabel];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end