Discussion Forums  >  Images, Documents, File Locations

Replies: 24    Views: 3609

brianhclo
Apple Fan
Profile
Posts: 12
Reg: Dec 04, 2012
Hong Kong
3,570
12/08/12 09:01 AM (13 years ago)

Background image to fit iphone 5 and iphone 4

HI, I am building my first app here and wanted to know what I need to do for my app's background to be compatible for both iphone 4 & 5 please? It seems there is no way to make it look right by changing the settings under "theme". Has anyone done it and know the solution? Thanks alot, Brian
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
12/08/12 09:45 AM (13 years ago)
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
12/08/12 10:30 PM (13 years ago)
also, making the image 320x570 works great...as long as you don't mind the bottom part of the image being cut off on a 3.5 inch screen
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
12/09/12 01:53 AM (13 years ago)
@Absentia. If you make a image 320x570 it will look blurry at iPhone 4 and 5. If you want a image look great at 4 end 5 you need 640x960 for iphone 4 and 640x 1136 for iphone 5. It will look sharp at the retina displays. If you add this four files you can see att my other topic to you xcode project. It will fix it. You have to set you background image name in you control panel and set Full Screen, Preserve ratio. You type in your first image name in bt CP 320x480 name like bg.png then you take all your image to you xcode prodject for iphone 4 640x946 [email protected] and for iphone 5 640x1136 [email protected]
 
brianhclo
Apple Fan
Profile
Posts: 12
Reg: Dec 04, 2012
Hong Kong
3,570
like
12/10/12 07:36 AM (13 years ago)
Mackimack, Sorry I am pretty new here. In terms of the steps I need to do. Does it mean.... 1) drag the 4 files into my project in Xcode. 2) upload bg.png into BT control panel. 3) drag [email protected] (iphone4) and [email protected] (iphone5) into the "BT_Images" folder in my project in xcode. And thats it?
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
12/10/12 07:51 AM (13 years ago)
Its ok I maybe explain it to bad. Go to this page https://gist.github.com/3799648 It is four file there, you drag them into your project. Then you make 3 image file for your background or splash. one with name bg.png ( 320x480) one bg@2xpng ( 640 x960) and that for iPhone 5 bf-568@xpng ( 640 x 1136) Drag them in to your image folder. you put it where ever you want Xcode understand where the folder are. Go to your CP to that screen you want a background image. Go to advanced settings go down to Backround image settings. Under Image file namn you write in bg.png and change scale/position to Full Screen, Preserve Ratio. Now you are done. You do the same where ever you want a image. 3 image file and you type in the smallest file in CP. I hope you understand now.
 
AIR POWERed Apps
buzztouch Evangelist
Profile
Posts: 38
Reg: Oct 23, 2012
Southern Califo...
4,680
like
12/22/12 08:40 PM (13 years ago)
Ok so I created all three files image.png, [email protected] and [email protected]. uploaded them to Xcode and bt_images I set the image.png as screen background at full screen, preserve ratio. I then downloaded the 4 files you said to from your link. I dropped them right into the xcode project. I tested the app on my iphone and simulators and all of them only show the low res image.png. Where did I go wrong? I attached screenshots. http://imageshack.us/a/img51/5596/screenshot20121222at903.png http://imageshack.us/a/img856/8273/screenshot20121222at904.png http://imageshack.us/a/img534/4517/screenshot20121222at905.png
 
brianhclo
Apple Fan
Profile
Posts: 12
Reg: Dec 04, 2012
Hong Kong
3,570
like
12/23/12 01:45 AM (13 years ago)
TJordan2011. I encountered the same problem as you. Any steps we have missed here?
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
12/23/12 02:02 AM (13 years ago)
HI Try this type in this #import "UIImage+H568.h" in BT_backgroundView.h See if it works. Don´t forget to delete you app in your simulator and clean your Xcode project.
 
AIR POWERed Apps
buzztouch Evangelist
Profile
Posts: 38
Reg: Oct 23, 2012
Southern Califo...
4,680
like
12/23/12 09:14 AM (13 years ago)
Ok, I cleaned my xcode project with command,option,shift + K. I then added #import "UIImage+H568.h" in BT_backgroundView.h I deleted the app off of my phone and simulators. Still only showing low res file. Are the four files downloaded off of your link supposed to be in any folder because they are just at the top of the hierarchy. http://imageshack.us/a/img51/5596/screenshot20121222at903.png Any other suggestions?
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
12/23/12 09:21 AM (13 years ago)
Strange! In My project I just add the files and everything works directly. You can send me your Xcode project if you want. But I can not look at it before wensday when I coming home. Marcsu at sweapp dot se
 
AIR POWERed Apps
buzztouch Evangelist
Profile
Posts: 38
Reg: Oct 23, 2012
Southern Califo...
4,680
like
12/23/12 02:04 PM (13 years ago)
Thanks for offering. If I cannot figure it out by then, I will send it your way. In the meantime, I created a new app just for testing this background code. I am able to get the bg.png and the [email protected] to work but the [email protected] does not load.
 
AIR POWERed Apps
buzztouch Evangelist
Profile
Posts: 38
Reg: Oct 23, 2012
Southern Califo...
4,680
like
12/24/12 03:59 PM (13 years ago)
Ok so I came up with a simple solution to the whole problem that requires no code at all. I created 2 pictures. bg.png (320 x 480) [email protected] (640 x 1136) [instead of traditional @2x size] I then saved the screens background as bg.png and selected top left for scale/position. The @2x picture is perfect for the iphone 5 size with retina clarity. For the iPhone 4, it cuts off only the bottom section of the background image. I just made sure that the background does not require the bottom part. It is just a "created by" cut in that will only be seen by iphone 5 users.
 
RFConcierge
Lost but trying
Profile
Posts: 142
Reg: May 08, 2012
San Diego, ca
7,520
like
12/28/12 02:23 PM (13 years ago)
I use prepo for some image work on the iphone. Put in an image and it spits out a lot of sizes for you. It's free in the mac app store. Ryan
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
01/07/13 06:10 PM (13 years ago)
Hey guys, I was having the same issue with this method not working -- I figured out a solution...you can read it here -- http://www.buzztouch.com/forum/thread.php?fid=55087E51F0182F0048E20AC&tid=55087E51F0182F0048E20AC
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
01/08/13 02:41 AM (13 years ago)
Hi Guys and fellow Buzztouchers, I was having the same problem in iPhone 5 but neglected it until yesterday, where I finally had to submit my app and it was the last remaining problem. I went head on and got it fixed. The process is mostly similar to what Absentia has said, but easier and a bit different. Tell me if you are successful or encounter any problems. This is what I did to be able to enable the [email protected] as a suffix for letting the compiler to know to use the said image for an iPhone 5 (which has a screen resolution height of 568px instead of the 480 of the previous iPhone 4s): 1. Download the four files here - https://gist.github.com/3799648 2. Extract the downloaded file (it is compressed) 3. Rename its whatchamacallit(!) folder (the folder you get after extracting it) with an easy to use "568h" 4. Drag and drop the folder onto your open xcode project explorer area. You will see a new folder in your project beside the BT_Docs and other folders named 568h. 5. Right click on and remove two unnecessary files named UIImageH568.h and UIImageH568.m (which are the two without the "+"s). I had a hunch that these were older versions and everything worked when I removed them. 6. Add a (#import "UIImage+H568.h") without the parantheses to both your appname_appDelegate.h and appname_appDelegate.m files just under the last #import line of the files. The appname prefix will be your app name in your project. These two files are in the BT_Config folder. 7. As Absentia mentioned, this will work in the simulator for you now, but since the iphone sdk inside the iphone device itself is a bit different you will need to do the following before running on a device otherwise you'll get a devil's warning (you know, the one thats red and makes you hold your breath and pray you can still press ctrl+z!). So if you're the faint hearted type of guy like I am, you better just do this now. In the UIImage+568.m file: REPLACE #import <objc/objc-runtime.h> WITH #import <objc/runtime.h> #import <objc/message.h> 7. This will do the trick for you as it did for me God willling, but if you run into any warnings you might want to follow Absentia's advice and finish up using his thread here: http://www.buzztouch.com/forum/thread.php?fid=55087E51F0182F0048E20AC&tid=55087E51F0182F0048E20AC It wasn't the case for me and I am happy with no warnings caught. So now you can have three versions of any background or splash screen file for small devices as follows and use the basic version without any suffixes in your BT_Config file. The device will itself chose the correct version from the three: background.png -for iPhone non-retina [email protected] -for iPhone retina like 4S [email protected] -for iPhone 5 Of course you can change the "background" part as you wish for your other images, it's just the suffixes that count. This method is extremely useful if you really need the bottom part of the background image and can't use the same image for your iPhone 4S and iPhone 5 layouts. Also for the background images you can use your control panel then just move the BT_Images into your project (as brianhclo asked), or just copy the files into the BT_Images in your project. As you might know, there is no difference. The control panel just helps you with a user interface, otherwise you can do it manually. Thanks to Angel G. Olloqui for the script on github. http://angelolloqui.com/blog/20-iPhone5-568h-image-loading Thanks to Absentia and Mackimack for their persistence in the issue. http://www.buzztouch.com/forum/thread.php?fid=55087E51F0182F0048E20AC&tid=55087E51F0182F0048E20AC
 
mutzy
Aspiring developer
Profile
Posts: 841
Reg: Nov 03, 2010
Medford, MA
9,860
like
01/16/13 07:36 PM (13 years ago)
I have done this three times now and I can't get it to load correctly in the simulator or my iPhone 5. Anyone else having problems?? Josh
 
lsills81
Apple Fan
Profile
Posts: 469
Reg: Mar 19, 2012
location unknow...
14,090
like
01/22/13 05:33 PM (12 years ago)
I did... follow the instructions as above but at the end do this: ~ Go to your control panel -- set image.png as your small device background image and set scale/position to "Full Screen/Preserve Ratio" I also had to name my Splash screen image "image.png"
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
01/24/13 01:24 AM (12 years ago)
Yes as I had mentioned and Isills81 just said, you have to of course set the small device background image of any screen you need to use through the control panel with a background image name as imagename.png. Then add the imagename.png and [email protected] and [email protected] files to your project's BT_Images in XCODE. (replace imagename with whatever image name you have, it's just as a sample). You have to use png files other wise it won't work, I mean I didn't try jpg files myself. You can do this for any number of screens you'd like. For instance I have a [email protected], a [email protected] and a [email protected] and all the other corresponding files (like the non @2x and the @2x versions among my images folder. Can you explain your case more Josh?
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
06/03/13 05:47 AM (12 years ago)
@ WebNevees, thanks for sharing, but I'm having the same problem as Josh have. I'm able to get the bg.png and the [email protected] to work but the [email protected] does not load on iphone (retina 4-inch). When I run the simulator. It just simply loads the image of [email protected]. I'm using BT self host. On the CP, I did changed the Scale / Position to Full screen preserve ratio. Xcode version 4.5.2 iPhone 6.0 Simulator
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
06/04/13 06:06 AM (12 years ago)
Hey guys, does anyone here use iOS6.0 and get it working? Or is this method only can be use on earlier iOS prior than 6.0.
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
06/04/13 09:11 AM (12 years ago)
Hey Cyrus, I'll make this easy for you go to this link to download the exact same .h and .m files that I use to accomplish this - https://www.dropbox.com/sh/kroa7vdn2frcbo6/dCpEZR4-rx All you should have to do is drag those two files into your project and the app will start recognizing the 568h@2x images. No need to #import stuff or tweak the code - just drag & drop and you're good to go
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
06/04/13 07:57 PM (12 years ago)
@Absentia, thank you so much! I have tried your way and set scale / position to Full screen preserve ratio. Tested in below Simulator iphone - bg.png iphone retina 3.5 - bg.png with full screen stretch iphone retina 4 - bg.png with full screen stretch Device iphone 4 - loads bg.png Not sure about iphone 5. Would it loads [email protected]? I have also tried to use AIR POWERed Apps way. Requires no code at all. Created 2 images only. bg.png (320 x 480), [email protected] (640 x 1136). Scale/position to top left. It cuts off only the bottom section of the background image. Both background image is overwritten by [email protected] with retina clarity. Simulator iphone - bg.png iphone retina 3.5 - [email protected] iphone retina 4 - [email protected] Device iphone 4 - [email protected] with retina clarity. Not sure about iphone 5. Again, would it loads [email protected]?
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/11/13 08:21 PM (12 years ago)
Wanted to thank everyone here for the info, some great collaboration - was successful for me! Thanks again! David https://buzztouchmods.com
 
Adam
Aspiring developer
Profile
Posts: 247
Reg: Oct 23, 2010
Southern Califo...
4,470
like
09/29/13 04:34 PM (12 years ago)
Can someone please update this forum? thanks, Adam
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.