-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocationTabView.m
94 lines (76 loc) · 3.62 KB
/
LocationTabView.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
//
// LocationTabView.m
// AvocadoTest1
//
// Created by Jake on 12-03-01.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "LocationTabView.h"
#import "LocationMapView.h"
#import "LocationState.h"
@implementation LocationTabView
- (id)initWithLocationState:(LocationState *) locationState AndFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
int locationBarHeight = 47;
int locationBarOpacityHeight = 44;
int labelWidth = 300;
int labelHeight = 30;
toolbarText = [[UILabel alloc] initWithFrame:CGRectMake(
(frame.size.width - labelWidth) / 2,
(locationBarOpacityHeight - labelHeight) / 2,
labelWidth,
labelHeight)];
[toolbarText setFont:[UIFont fontWithName:@"Optima-ExtraBlack" size:22]];
[toolbarText setTextColor:[UIColor whiteColor]];
[toolbarText setBackgroundColor:[UIColor clearColor]];
[toolbarText setTextAlignment:UITextAlignmentCenter];
locationMapView = [[LocationMapView alloc] initWithLocationState:locationState AndFrame:CGRectMake(
frame.origin.x,
frame.origin.y + locationBarOpacityHeight,
frame.size.width,
frame.size.height - locationBarOpacityHeight)];
whiteBar = [[UIView alloc] initWithFrame:CGRectMake(
frame.origin.x,
frame.origin.y + locationBarOpacityHeight,
frame.size.width,
34)];
[whiteBar setBackgroundColor:[UIColor whiteColor]];
[whiteBar setAlpha:0.8f];
whiteBarLabel = [[UILabel alloc] initWithFrame:CGRectMake(
([whiteBar frame].size.width - labelWidth)/2 + [whiteBar frame].origin.x,
([whiteBar frame].size.height - labelHeight)/2 + [whiteBar frame].origin.y,
labelWidth,
labelHeight)];
[whiteBarLabel setBackgroundColor:[UIColor clearColor]];
[whiteBarLabel setTextAlignment:UITextAlignmentCenter];
[whiteBarLabel setAdjustsFontSizeToFitWidth:YES];
[whiteBarLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Medium" size:16.0f]];
[whiteBarLabel setTextColor:[UIColor colorWithRed:0.5f green:0.03f blue:0.03f alpha:1.0f]];
locationToolBarImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BlankTopbarWithShadow.png"]];
[locationToolBarImage setFrame:CGRectMake(
frame.origin.x,
frame.origin.y,
frame.size.width,
locationBarHeight)];
[whiteBarLabel setText:@"Tap a location to order from"];
[toolbarText setText:@"Locations"];
[self addSubview:locationMapView];
[self addSubview:whiteBar];
[self addSubview:whiteBarLabel];
[self addSubview:locationToolBarImage];
[self addSubview:toolbarText];
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end