-
Notifications
You must be signed in to change notification settings - Fork 0
/
PLBaseOrderViewController.m
108 lines (84 loc) · 4.05 KB
/
PLBaseOrderViewController.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
// PLBaseOrderViewController.m
// Plate
//
// Created by emileleon on 12/5/13.
// Copyright (c) 2013 Plate SF. All rights reserved.
//
#import "PLBaseOrderViewController.h"
#import "Colours.h"
#import "PLBasketViewController.h"
@interface PLBaseOrderViewController ()
@end
@implementation PLBaseOrderViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
// Setup the background
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:@"bg-tomatoes.png"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
// self.edgesForExtendedLayout=UIRectEdgeNone;
// Setup the navigation bar
[[self navigationItem] setTitle:@"Create a Plate"];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont
fontWithName:@"Helvetica" size:24], NSFontAttributeName,
[UIColor whiteColor], NSForegroundColorAttributeName, nil];
self.navigationController.navigationBar.titleTextAttributes = attributes;
// Setup the bottom toolbar
UIBarButtonItem *flexibleSpaceLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *continueButton = [[UIBarButtonItem alloc] initWithTitle:@"Continue" style:UIBarButtonItemStylePlain target:self action:@selector(actionContinue:)];
UIBarButtonItem *statusButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
[continueButton setTitleTextAttributes:@{
NSFontAttributeName: [UIFont fontWithName:@"Helvetica" size:18.0],
NSForegroundColorAttributeName: [UIColor moneyGreenColor]
} forState:UIControlStateNormal];
UIFontDescriptor *fontDescriptor = [[UIFontDescriptor alloc] init];
UIFontDescriptor *fontDescriptorForHelveticaNeue = [fontDescriptor fontDescriptorWithFamily:@"Helvetica Neue"];
UIFontDescriptor *symbolicFontDescriptor = [fontDescriptorForHelveticaNeue fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic];
UIFont *statusButtonFont = [UIFont fontWithDescriptor:symbolicFontDescriptor size:18.0];
[statusButton setTitleTextAttributes:@{
NSFontAttributeName: statusButtonFont,
NSForegroundColorAttributeName: [UIColor moneyGreenColor]
} forState:UIControlStateNormal];
self.toolbarItems = [NSArray arrayWithObjects: statusButton, flexibleSpaceLeft, continueButton, nil];
// We don't want extra space above tables for scrolling
self.automaticallyAdjustsScrollViewInsets = NO;
}
- (void)viewDidAppear:(BOOL)animated
{
self.navigationController.toolbarHidden = NO;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)displayBasketInNavBar
{
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(displayBasket)];
}
- (void)actionContinue:(id)sender
{
// do nothing
NSLog(@"***** ActionContinue must be implemented! *****");
}
- (void)displayBasket
{
// Display contents of basket
PLBasketViewController *bvc = [[PLBasketViewController alloc] init];
bvc.hidesBottomBarWhenPushed = YES;
[[self navigationController] pushViewController:bvc animated:YES];
}
@end