FreeRDP
Loading...
Searching...
No Matches
EditSubEditTableViewCell.m
1/*
2 Custom table cell indicating a switch to a sub-view
3
4 Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
5
6 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 If a copy of the MPL was not distributed with this file, You can obtain one at
8 http://mozilla.org/MPL/2.0/.
9 */
10
11#import "EditSubEditTableViewCell.h"
12
13@interface EditSubEditTableViewCell (Private)
14- (void)updateContent;
15@end
16
17@implementation EditSubEditTableViewCell
18
19@synthesize title = _title, enabled = _enabled;
20
21- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
22{
23 self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
24 if (self)
25 {
26 // Initialization code
27 _enabled = YES;
28 [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
29 }
30
31 return self;
32}
33
34- (void)dealloc
35{
36 [_title release];
37 [super dealloc];
38}
39
40- (void)prepareForReuse
41{
42 [super prepareForReuse];
43
44 [_title release];
45 _title = nil;
46 _enabled = YES;
47 [self setSelectionStyle:UITableViewCellSelectionStyleDefault];
48 [self updateContent];
49}
50
51- (void)setTitle:(NSString *)title
52{
53 if (_title != title)
54 {
55 [_title release];
56 _title = [title copy];
57 }
58 [self updateContent];
59}
60
61- (void)setEnabled:(BOOL)enabled
62{
63 _enabled = enabled;
64 [self updateContent];
65}
66
67- (void)updateContent
68{
69 UIListContentConfiguration *content = [self defaultContentConfiguration];
70 [content setText:_title];
71 if (!_enabled)
72 [[content textProperties] setColor:[UIColor tertiaryLabelColor]];
73 [self setContentConfiguration:content];
74}
75
76@end