Best cocoa-touch questions in March 2011

iOS: Using device modifiers for loading xib files?

16 votes

You can use a device modifier (i.e., ~ipad) to provide a device-specific key in Info.plist, and to specify a device-specific launch image (Default.png for iPhone, and Default~ipad.png for iPad, for example). Those two things are specifically mentioned in Apple Docs, but they don't say that this will work for any other kinds of files.

I've discovered (quite by accident) that this works for loading .xib files via initWithNibName:bundle:. So for example, I can have MyView.xib and MyView~ipad.xib, and this code:

MyViewController *viewController = [[MyViewController alloc] 
                                     initWithNibName:@"MyView" bundle:nil];

... will totally load MyView~ipad.xib on an iPad, and MyView.xib on other devices.

So, 1) Is this documented somewhere? I sure couldn't find it any any Apple docs. It's sure handier than checking UI_USER_INTERFACE_IDIOM() and hardcoding two different nib names everywhere, but I kinda don't trust it if it isn't documented.

And, 2) Does anyone know what version of iOS this started working in? I've only tried it in 4.2, and it works there. Device modifiers in general (even for the documented things listed above) are 4.0 minimum.

I hate to be that guy and answer my own question, but I think the answer is:

1) Nope, not explicitly documented in any Apple documentation, and
2) 4.0 and higher (this based on my own testing)

All you really save is a couple lines of code checking for UI_USER_INTERACE_IDIOM(). Still, I'll take it. Less code is less code.

Xcode 4 failure to symbolicate Crash Log

13 votes

I have just updated my Xcode to 4.0.1. Now I have a problem with the symbolication of the crash logs received from my tester and even from my phone too.

When I build the AdHoc distribution I am using the "Arhive" scheme, then I create the *.ipa file singing it with my developer credentials.

Is this the issue? And I can't find the dSym files for these AdHoc builds.

Further to coob's answer, I find adding these directories to Spotlight's ignore list (System Preferences → Spotlight → Privacy) helps:

  • ~/Library/Developer/Xcode/DerivedData/ (Xcode 4 build artefacts)
  • ~/Library/Application Support/iPhone Simulator/ (file system for the iPhone Simulator)

Like this:

Spotlight settings to suppress unhelpful .app files

(See this blog post for additional detail.)

Update: from a comment by joerick: "This works, but it also meant that Instruments.app couldn't find the debug symbols, so I had to remove DerivedData from the Privacy list to do some profiling." - bear this in mind if you use Instruments.

9 votes

hi people , i need help in UITableViewCell of UITableView.My requirement is below:

enter image description here

look at Retweets , list and More when i click retweet following appears enter image description here

you can see that retweet expands and shows other listing and list and more slide below. i want to make the same . Any type of help is highly appreciated ,tutorial link or anything . thank you

You may also find this sample code from Apple, helpful.