【问题标题】:Style for textField added as subview to celltextField 的样式作为子视图添加到单元格
【发布时间】:2012-09-05 22:50:53
【问题描述】:

在我当前的 iOS 项目中,我向 tableView 添加了一个带有标签和文本字段的动态单元格。我正在使用以下代码来制作 textField:

UITextField *inputField;
inputField = [[UITextField alloc] initWithFrame:CGRectMake(120,12,185,30)];
inputField.textAlignment = UITextAlignmentRight;
inputField.adjustsFontSizeToFitWidth = YES;
inputField.placeholder = @"your text here...";
[cell addSubview:inputField];

结果如下所示:

我的问题是如何设置代码生成的文本字段的样式,使其看起来像常规的 IB 文本字段?

【问题讨论】:

    标签: iphone objective-c xcode cocoa-touch uitextfield


    【解决方案1】:
    inputField.borderStyle = UITextBorderStyleRoundedRect;
    

    这是borderStyle 属性reference 供您检查。

    【讨论】:

    • 谢谢,这正是我所追求的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-12
    • 1970-01-01
    • 2011-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多