Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-08-2010, 06:23 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 17
Unhappy UIImageView shows in simulator, does not show on device

Hello,

I have a UIScrollView that has three view controllers added to it, as such:

Code:
	[scrollView addSubview:islandViewController.view];
On one of them, I'm adding three images in viewDidLoad:

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	
	CGRect myImageRect = CGRectMake(0.0f,0.0f, 320.0f, 480.0f);
	UIImageView *sky = [[UIImageView alloc] initWithFrame:myImageRect];
	[sky setImage:[UIImage imageNamed:@"sky.png"]];
	sky.opaque = YES; // explicitly opaque for performance
	[self.view addSubview:sky];
	[sky release];
	
	CGRect myImageRect3 = CGRectMake(0.0f,432.0f, 320.0f, 48.0f);
	UIImageView *sea = [[UIImageView alloc] initWithFrame:myImageRect3];
	[sea setImage:[UIImage imageNamed:@"sea.png"]];
	sea.opaque = NO; 
	[self.view addSubview:sea];
	[sea release];
	
	CGRect myImageRect2 = CGRectMake(40.0f,365.0f, 241.0f, 101.0f);
	UIImageView *island = [[UIImageView alloc] initWithFrame:myImageRect2];
	[island setImage:[UIImage imageNamed:@"island.png"]];
	island.opaque = NO; 
	[self.view addSubview:island];
	[island release];

}
When I'm running it on the simulator all images are shown fine. When building and running on the device, only the "sea" image is shown.

I've tried cleaning and re-building, changing the order of the images, looking for lowercase/uppercase issues... All seems fine.
What could be the problem, and more importantly, how could this be fixed?

Thanx in advance,
Nir.
hermonir is offline   Reply With Quote
Old 03-08-2010, 10:42 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,558
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

When I've had problems like this, that were not related to spelling/capitalization, it's usually due to a corrupt image. I just open the .png in a graphics editor and resave it as the same name. Sometimes I guess the png gets corrupted where the simulator can still read it, but not the device.
smithdale87 is offline   Reply With Quote
Old 03-08-2010, 12:42 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 17
Default Tried that too...

Quote:
Originally Posted by smithdale87 View Post
When I've had problems like this, that were not related to spelling/capitalization, it's usually due to a corrupt image. I just open the .png in a graphics editor and resave it as the same name. Sometimes I guess the png gets corrupted where the simulator can still read it, but not the device.
Maybe I should try with jpegs, just to see what happens.
hermonir is offline   Reply With Quote
Old 08-29-2011, 10:42 PM   #4 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 8
Unhappy Same here: UIImage shows in simulator, not on device

Got the same frustrating issue -got 3 PNGs on UIImage, shows on simulator, but not on device. And it used to show on the device, modified the code, reinstalled on the device and it stopped showing.

The thing that's weird, I copied this program to Prog B, copied the same 3 PNGs and given different names, plus 2 more PNGs for Prog B. On the simulator, Prog A and Prog B PNGs show up, but on the device, only Prog B images, not Prog A!! Take note, I use the same UIViewController: Prog A and Prog B calls the same UIViewController, the only thing different is Prog A and Prog B pass a different filename prefix to the controller. I'm so stumped!!
Cori is offline   Reply With Quote
Old 08-29-2011, 11:05 PM   #5 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 4,999
Default

Are the filenames correct? And keep in mind the filesystem on device is case sensitive. "Test.png" and "test.png" would be two different files on a device.
baja_yu is offline   Reply With Quote
Old 08-30-2011, 01:25 PM   #6 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 8
Default

You're right baja_yu - it's filename but stupid me, it's the file prefix I passed! I missed 1 letter: UguidePage - g should have been a CAP. That's why it's a consistent bug!! Duh!!

Last edited by Cori; 08-30-2011 at 01:45 PM. Reason: updated
Cori is offline   Reply With Quote
Old 10-28-2011, 12:31 AM   #7 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 1
Default

Quote:
Originally Posted by baja_yu View Post
Are the filenames correct? And keep in mind the filesystem on device is case sensitive. "Test.png" and "test.png" would be two different files on a device.
a millions thanks, u saved my life!
xjulianx is offline   Reply With Quote
Old 02-04-2012, 04:50 PM   #8 (permalink)
Registered Member
 
Join Date: Feb 2012
Posts: 1
Default

I just encountered a very similar problem; thought I'd share to save someone else wasting an hour like I just did trying to solve the problem!

image@2X.png is NOT the same as image@2x.png
jrt01uk is offline   Reply With Quote
Old 02-04-2012, 05:02 PM   #9 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 4,814
Default A case-sensitve file system is STUPID!

Quote:
Originally Posted by jrt01uk View Post
I just encountered a very similar problem; thought I'd share to save someone else wasting an hour like I just did trying to solve the problem!

image@2X.png is NOT the same as image@2x.png
I wonder how many thousands of programmer-hours us iOS developers have wasted because of the case-sensitivity of the iOS file system. I would cheerfully strangle the developer at Apple that decided to make the case sensitivity of iOS different from Mac OS (and thus different from the simulator.) I personally think case sensitive filenames are a very, very bad idea.

My other pet peeve is the screwed up coordinate system in the graphics engine in iOS. Mac OS consistently places 0,0 at the lower left, increasing as you to go up and to the right.

iOS is MOSTLY upside-down from that, but it isn't even consistent with itself!!! UIKit objects place 0,0 at the top left, and CALayers place it at the bottom left! WTF?!? Again, the programmers responsible should be shot. (this is, of course, hyperbole. I'm not really advocating violence, just expressing frustration.)
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Tags
device, simulator, uiimageview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 242
12 members and 230 guests
ADY, AragornSG, CKAmike, Dani77, Duncan C, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0