-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyCartViewController.m
More file actions
104 lines (78 loc) · 2.97 KB
/
MyCartViewController.m
File metadata and controls
104 lines (78 loc) · 2.97 KB
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
//
// MyCartViewController.m
// myKEA
//
// Created by Novall Khan on 11/19/14.
// Copyright (c) 2014 Novall Khan. All rights reserved.
//
#import "MyCartViewController.h"
#import "GoogleAnalytics.h"
#import "Theme+Colors.h"
@interface MyCartViewController () <UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate>
@end
@implementation MyCartViewController
- (void)viewDidAppear:(BOOL)animated
{
[GoogleAnalytics trackUIActionCategoryWithAction:GoogleAnalyticsActionNavigation
label:GoogleAnalyticsLabelNavigatedToCart];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - UITableView DataSource and Delegate Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];
// NSArray *placeholderArray = @[@"lamp", @"table", @"chairs", @"plates", @"pots", @"pans", @"desk"];
// cell.textLabel.text = placeholderArray[indexPath.row];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 30;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)];
view.layer.borderWidth = 1;
view.layer.borderColor = [UIColor grayColor].CGColor;
/* Create custom view to display section header... */
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)];
[label setFont:[UIFont systemFontOfSize:20]];
label.textAlignment = NSTextAlignmentCenter;
NSString *string =@"My Cart";
/* Section header is in 0th index... */
[label setText:string];
[view addSubview:label];
[label setTextColor:[UIColor darkGrayColor]];
[view setBackgroundColor:[UIColor whiteColor]];
return view;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
- (IBAction)cameraSegueButtonPressed:(id)sender
{
[GoogleAnalytics trackUIActionCategoryWithAction:GoogleAnalyticsActionNavigation
label:GoogleAnalyticsLabelNavigatedBackToHome];
[self dismissViewControllerAnimated:YES completion:nil];
}
@end