【问题标题】:ios uitextfield like notesios uitextfield 喜欢笔记
【发布时间】:2011-02-23 23:33:43
【问题描述】:

我希望我的 uitextfield 看起来像 iPhone 的笔记,黄色的线条.. 最好的方法是什么? 提前致谢!

【问题讨论】:

    标签: iphone ios background uitextfield


    【解决方案1】:

    你的意思是 UItextview 对吧? ...它不是 UITextField。 但是,请清除 UITextView 上的背景。

    self.textView.backgroundColor =  [UIColor clearColor];
    

    然后创建您将作为子视图放入文本视图的 ImageView。

    backgroundimage = [[UIImageView alloc] initWithFrame: CGRectMake(0, -14,textView.frame.size.width, textView.fram.size.height)];
    

    将图案图像设置为背景颜色。这将是你的台词。只需创建或两行。然后它应该重复自己。

    backgroundimage.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"lines.png"];
    

    然后将您的子视图添加到文本视图。

    [self.textView addSubview:backgroundimage];
    

    祝你好运!

    【讨论】:

    • 而不是创建一个backgroundView,只需将UITextView的背景颜色设置为[UIColor colorWithPatternImage:[UIImage imageNamed:@"lines.png"];
    猜你喜欢
    • 1970-01-01
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-27
    相关资源
    最近更新 更多