8a7a6a9876a2a670b02763fdf6b1124338a0e4f8
[atutor.git] / mods / atsocial_iphone_app / InAppSettingsKit / Views / IASKPSTextFieldSpecifierViewCell.m
1 //
2 //  IASKPSTextFieldSpecifierViewCell.m
3 //  http://www.inappsettingskit.com
4 //
5 //  Copyright (c) 2009-2010:
6 //  Luc Vandal, Edovia Inc., http://www.edovia.com
7 //  Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com
8 //  All rights reserved.
9 // 
10 //  It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, 
11 //  as the original authors of this code. You can give credit in a blog post, a tweet or on 
12 //  a info page of your app. Also, the original authors appreciate letting them know if you use this code.
13 //
14 //  This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php
15 //
16
17 #import "IASKPSTextFieldSpecifierViewCell.h"
18 #import "IASKTextField.h"
19 #import "IASKSettingsReader.h"
20
21 @implementation IASKPSTextFieldSpecifierViewCell
22
23 @synthesize label=_label,
24             textField=_textField;
25
26 - (void)layoutSubviews {
27         CGSize labelSize = [_label sizeThatFits:CGSizeZero];
28         labelSize.width = MIN(labelSize.width, _label.bounds.size.width);
29
30         CGRect textFieldFrame = _textField.frame;
31         textFieldFrame.origin.x = _label.frame.origin.x + MAX(kIASKMinLabelWidth, labelSize.width) + kIASKSpacing;
32         if (!_label.text.length)
33                 textFieldFrame.origin.x = _label.frame.origin.x;
34         textFieldFrame.size.width = kIASKTableWidth - textFieldFrame.origin.x - _label.frame.origin.x;
35         _textField.frame = textFieldFrame;
36 }
37
38 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
39
40     [super setSelected:selected animated:animated];
41
42     // Configure the view for the selected state
43 }
44
45
46 - (void)dealloc {
47     [super dealloc];
48 }
49
50
51 @end