Re: +[UINib nibWithNibName:bundle:] and ~iPhone
Re: +[UINib nibWithNibName:bundle:] and ~iPhone
- Subject: Re: +[UINib nibWithNibName:bundle:] and ~iPhone
- From: glenn andreas <email@hidden>
- Date: Wed, 17 Aug 2011 09:55:06 -0500
More specifically, from the documentation:
To associate a resource file with a particular device, you add a custom modifier string to its filename. The inclusion of this modifier string yields filenames with the following format:
<basename><device>.<filename_extension>
The <basename> string represents the original name of the resource file. It also represents the name you use when accessing the file from your code. Similarly, the <filename_extension> string is the standard filename extension used to identify the type of the file. The <device> string is a case-sensitive string that can be one of the following values:
• ~ipad - The resource should be loaded on iPad devices only.
• ~iphone - The resource should be loaded on iPhone or iPod touch devices only.
I.e, it needs to be UserLeagueCell~iphone.xib, not UserLeagueCell~iPhone.xib. On the simulator, OS X, not being case sensitive, will load find UserLeagueCell~iPhone.xib but on the device, being case sensitive, it will only look for UserLeagueCell~iphone.xib.
p.s., good luck dealing with renaming UserLeagueCell~iPhone.xib to UserLeagueCell~iphone.xib if you've got it checked into svn. The last time I made that mistake I found it was easier to just check in a brand new file with a different name all together (like UserLeagueCell2~iphone.xib) than to deal with the "but it is already checked out, even though the case is wrong"...
On Aug 17, 2011, at 7:56 AM, Jim Adams wrote:
> Did you check that cases of the names involved?
>
> -----Original Message-----
> From: cocoa-dev-bounces+jim.adams=email@hidden [mailto:cocoa-dev-bounces+jim.adams=email@hidden] On Behalf Of Rick Mann
> Sent: Wednesday, August 17, 2011 12:35 AM
> To: Cocoa Developer
> Subject: +[UINib nibWithNibName:bundle:] and ~iPhone
>
> I'm seeing some weird difference between Device and Simulator for iPhone.
>
> Xcode 3.2.6
> Simulator 4.3(8F190)
> iOS 4.3.38J2)
>
> I call
>
> UINib* nib = [UINib nibWithNibName: @"UserLeagueCell" bundle: nil];
>
> on the simulator, this actually seems to return the nib named "UserLeagueCell~iPhone.xib". On the device, it returns the nib named "UserLeagueCell.xib".
>
> Is this a known difference in the two?
>
> Thanks,
> Rick
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
Glenn Andreas email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden