FreeRDP
Loading...
Searching...
No Matches
EditFlagTableViewCell.m
1/*
2 Custom table cell with toggle switch
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 "EditFlagTableViewCell.h"
12
13@implementation EditFlagTableViewCell
14
15@synthesize title = _title, toggle = _toggle;
16
17- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
18{
19 self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
20 if (self)
21 {
22 [self setSelectionStyle:UITableViewCellSelectionStyleNone];
23
24 _toggle = [[UISwitch alloc] init];
25 [self setAccessoryView:_toggle];
26 }
27
28 return self;
29}
30
31- (void)dealloc
32{
33 [_title release];
34 [_toggle release];
35 [super dealloc];
36}
37
38- (void)setTitle:(NSString *)title
39{
40 if (_title != title)
41 {
42 [_title release];
43 _title = [title copy];
44 }
45
46 UIListContentConfiguration *content = [self defaultContentConfiguration];
47 [content setText:title];
48 [self setContentConfiguration:content];
49}
50
51@end