简体   繁体   English

UITextView背景图片iPhone

[英]UITextView BackGround image iphone

I m working on note app. 我正在使用笔记应用程序。 In which im creating view like iPhone notes. 我在其中创建类似iPhone注释的视图。 First i took a scroll view and then one image view. 首先,我使用了滚动视图,然后是一个图像视图。 After that I m creating a UITextView dynamically... I set the background image of UITextView .. using this code 在那之后我米创建UITextView动态...我设置的背景图像UITextView使用此代码..

textView = [[UITextView alloc]initWithFrame:CGRectMake(0,30,320,400)];
 textView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed: @"lines.png"]];

Its working perfect in simulator. 它在模拟器中的完美工作。 but when i run my app on device then UITextView 's background doesn't display... means it doesn't display lines... My image size is 365x45... Can anybody help me why this happen???? 但是当我在设备上运行我的应用程序时, UITextView的背景不会显示...意味着它不会显示线条...我的图像大小是365x45 ...有人可以帮我为什么会这样吗? Where is the problem??? 问题出在哪儿??? thanks!! 谢谢!!

I had a similar problem once and got grey hair over it. 我曾经有过类似的问题,并且满头白发。 :) :)

Double check whether your background image file (the .png or whatever) is still boundled with your app. 仔细检查您的背景图片文件(.png或其他内容)是否仍与应用绑定在一起。 Check this with the project or tartet settings when you have multiple targets. 当您有多个目标时,请使用项目或项目设置进行检查。

In my case the file was included in the project but not in the boundle. 就我而言,文件包含在项目中,但没有包含在边界中。 For reasons that I never understood it was part of the bounle installed on the simulator. 由于我从未理解的原因,它是模拟器上安装的工具的一部分。 It was even there when I deleted the app manually from the simulator's file system. 当我从模拟器的文件系统中手动删除该应用程序时,它甚至在那里。 Re-launched the app in the simulator and it was there again. 在模拟器中重新启动该应用程序,该应用程序再次出现。

But when I checked the content of the boundles that where sent to debug devices or the store, the image file was missing. 但是,当我检查发送到调试设备或商店的边界内容时,图像文件丢失了。

The same problem may occour to you. 您可能会遇到同样的问题。

I never used that method. 我从未使用过这种方法。 What I do is I put an invisible UITextView over the UIImageView 我要做的是在UIImageView上放置一个不可见的UITextView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM