UITextView背景颜色

0 uitextview ios

我试图UITextView在Xcode 5中获得带有黑色背景或透明背景的白色文本.在Xcode中没有滑块或设置,必须是以前版本中的一个,我在这里的问题中可以看到.但不是了.我也见过这个

UItextView.backgroundColor = [UIColor clearColor];
Run Code Online (Sandbox Code Playgroud)

作为一种解决方法.但不知道在哪里放这个,如果它甚至是正确的.谢谢

Joe*_*ara 5

当然你可以通过编程方式完成:

UITextView *txt = [[[UITextView alloc] initWithFrame: CGRectMake(10, 10, 100, 60)] autorelease];
[txt setBackgroundColor: [UIColor clearColor]];
[txt setTextColor: [UIColor whiteColor]];
Run Code Online (Sandbox Code Playgroud)

但您也可以通过图形编辑器设置的属性检查器分别将颜色颜色设置为"白色"和背景设置为"清除颜色"来完成此操作.

这是自定义背景的结果:

UITextView与阿尔法背景和白色文本