-
Notifications
You must be signed in to change notification settings - Fork 0
/
PLMenuItemTableViewCell.m
62 lines (49 loc) · 1.55 KB
/
PLMenuItemTableViewCell.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
//
// PLALaCarteTableViewCell.m
// Plate
//
// Created by emileleon on 1/14/14.
// Copyright (c) 2014 Plate SF. All rights reserved.
//
#import "PLMenuItemTableViewCell.h"
@implementation PLMenuItemTableViewCell
- (IBAction)viewItemDetail:(id)sender {
[[self delegate]displayItemDetail:self];
}
-(void)setupDelegate:(id<MenuItemTableViewCellDelegate>)cellDelegate parentTable:(UITableView *)tableView
{
if (self) {
self.parentTableView = tableView;
self.delegate = cellDelegate;
// self.layer.borderWidth = 1.0f;
// self.layer.borderColor = [[UIColor blackColor] CGColor];
// self.layer.masksToBounds = YES;
// self.layer.cornerRadius = 12.0f;
// self.layer.backgroundColor = [[UIColor grayColor] CGColor];
}
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)prepareForReuse {
[super prepareForReuse];
self.delegate = nil;
}
- (IBAction)increaseQuantity:(id)sender {
int q = [[self delegate] addItemWithCell:self];
self.quantityLabel.text = [NSString stringWithFormat:@"%d", q];
}
- (IBAction)decreaseQuantity:(id)sender {
int q = [[self delegate] removeItemWithCell:self];
self.quantityLabel.text = [NSString stringWithFormat:@"%d", q];
}
@end