ios uitextfield 喜欢笔记 [英] ios uitextfield like notes

查看:10
本文介绍了ios uitextfield 喜欢笔记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I wish that my uitextfield seems like the notes of the iPhone, yellow with the lines.. what's the best way to do this? thanks in advance!

推荐答案

你是说 UItextview 吧?...它不是 UITextField.但是,请清除 UITextView 上的背景.

You mean UItextview right? ... its not a UITextField. However, clear your background on the UITextView.

self.textView.backgroundColor =  [UIColor clearColor];

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

Then create ImageView that u put as a subview to your textview.

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

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

set a pattern image as backgroundColor. This will be your lines. Just create on or two lines . Then it should repeat itself.

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

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

then add your subview to the textview.

[self.textView addSubview:backgroundimage];

祝你好运!

这篇关于ios uitextfield 喜欢笔记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆