IOS的UITextField像音符 [英] ios uitextfield like notes

查看:181
本文介绍了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的ü把作为一个子视图到你的TextView。

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)];

树立了榜样形象的backgroundColor。这将是你的线条。只要创建或两行。那么它应该重演。

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"];

那么你的子视图添加到TextView的。

then add your subview to the textview.

[self.textView addSubview:backgroundimage];

祝你好运!

这篇关于IOS的UITextField像音符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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