blob: 04e64460b2cb09e85f8734ac6b33a02060994f2b (
plain)
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
|
#import "MWMPlacePageButtonCell.h"
#import "MWMPlacePageViewManager.h"
#import "UIColor+MapsMeColor.h"
@interface MWMPlacePageButtonCell ()
@property (weak, nonatomic) MWMPlacePageViewManager * manager;
@property (weak, nonatomic) IBOutlet UIButton * titleButton;
@property (nonatomic) MWMPlacePageCellType type;
@end
@implementation MWMPlacePageButtonCell
- (void)config:(MWMPlacePageViewManager *)manager forType:(MWMPlacePageCellType)type
{
self.manager = manager;
switch (type)
{
case MWMPlacePageCellTypeAddBusinessButton:
[self.titleButton setTitle:L(@"placepage_add_business_button") forState:UIControlStateNormal];
break;
case MWMPlacePageCellTypeEditButton:
[self.titleButton setTitle:L(@"edit_place") forState:UIControlStateNormal];
break;
case MWMPlacePageCellTypeAddPlaceButton:
[self.titleButton setTitle:L(@"placepage_add_place_button") forState:UIControlStateNormal];
break;
case MWMPlacePageCellTypeBookingMore:
[self.titleButton setTitle:L(@"details") forState:UIControlStateNormal];
break;
default:
NSAssert(false, @"Invalid place page cell type!");
break;
}
self.type = type;
}
- (IBAction)buttonTap
{
switch (self.type)
{
case MWMPlacePageCellTypeEditButton:
[self.manager editPlace];
break;
case MWMPlacePageCellTypeAddBusinessButton:
[self.manager addBusiness];
break;
case MWMPlacePageCellTypeAddPlaceButton:
[self.manager addPlace];
break;
case MWMPlacePageCellTypeBookingMore:
[self.manager book:YES];
break;
default:
NSAssert(false, @"Incorrect cell type!");
break;
}
}
@end
|