简体   繁体   中英

UITextView BackGround image iphone

I m working on note app. In which im creating view like iPhone notes. 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

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???? 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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