forked from organicmaps/organicmaps
[ios] Added MWMEditorCategoryCell class.
This commit is contained in:
parent
ee16e936d8
commit
e07640b2d2
2 changed files with 48 additions and 0 deletions
7
iphone/Maps/Classes/Editor/MWMEditorCategoryCell.h
Normal file
7
iphone/Maps/Classes/Editor/MWMEditorCategoryCell.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
@protocol MWMEditorCellProtocol;
|
||||
|
||||
@interface MWMEditorCategoryCell : UITableViewCell
|
||||
|
||||
- (void)configureWithDelegate:(id<MWMEditorCellProtocol>)delegate detailTitle:(NSString *)detail isCreating:(BOOL)isCreating;
|
||||
|
||||
@end
|
41
iphone/Maps/Classes/Editor/MWMEditorCategoryCell.mm
Normal file
41
iphone/Maps/Classes/Editor/MWMEditorCategoryCell.mm
Normal file
|
@ -0,0 +1,41 @@
|
|||
#import "MWMEditorCategoryCell.h"
|
||||
#import "MWMEditorCommon.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIImageView+Coloring.h"
|
||||
|
||||
@interface MWMEditorCategoryCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView * accessoryIcon;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * detail;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * detailRightSpace;
|
||||
@property (weak, nonatomic) id<MWMEditorCellProtocol> delegate;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMEditorCategoryCell
|
||||
|
||||
- (void)configureWithDelegate:(id<MWMEditorCellProtocol>)delegate detailTitle:(NSString *)detail isCreating:(BOOL)isCreating
|
||||
{
|
||||
self.delegate = delegate;
|
||||
self.detail.text = detail;
|
||||
self.accessoryIcon.hidden = !isCreating;
|
||||
if (isCreating)
|
||||
{
|
||||
self.selectedBackgroundView = [[UIView alloc] init];
|
||||
self.selectedBackgroundView.backgroundColor = [UIColor pressBackground];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
self.detailRightSpace.constant -= self.accessoryIcon.width / 2;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)cellTap
|
||||
{
|
||||
if (self.accessoryIcon.hidden)
|
||||
return;
|
||||
[self.delegate cellSelect:self];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Reference in a new issue