2 // IASKPSTextFieldSpecifierViewCell.m
3 // http://www.inappsettingskit.com
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.
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.
14 // This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php
17 #import "IASKPSTextFieldSpecifierViewCell.h"
18 #import "IASKTextField.h"
19 #import "IASKSettingsReader.h"
21 @implementation IASKPSTextFieldSpecifierViewCell
23 @synthesize label=_label,
26 - (void)layoutSubviews {
27 CGSize labelSize = [_label sizeThatFits:CGSizeZero];
28 labelSize.width = MIN(labelSize.width, _label.bounds.size.width);
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;
38 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
40 [super setSelected:selected animated:animated];
42 // Configure the view for the selected state