开发者

Navigation bar button doesn't work after updating current target for iPad

I'm trying to convert my iPhone app to a "universal" app with the following steps. The app's first screen has a navigation bar.

  1. Download and install Xcode 3.2.3 and iPhone SDK 4.
  2. Open an existing Xcode project of an iPhone app, select the target and choose "Update Current Target for iPad..." from the File menu.
  3. Select "One Universal application" in the popup that appears.

Now when I start the app in an iPad or the iPad simulator, the navigation bar is displayed all right but the right bar button item just doesn't work. I've confirmed that the rightBarButtonItem is enabled,

(gdb) p (int)[[[firstController navigationItem] rightBarButtonItem] isEnabled]
$2 = 1

se开发者_如何转开发arched high and low for a solution, but no clue so far.


Turns out it's a known issue documented in the iPhone SDK Release Notes for iOS 4:

When selecting a target and then choosing "Update Current Target for iPad," new nib files are created but not converted to iPad. To fix this problem:

  • Either select each nib file that was copied, open it in Interface Builder, select the "File -> Create iPad Version" menu option, then select "Save As…" for the document, and save over the nib file.

  • Or invoke this command in the terminal from the project's folder:

    find Resources-iPad -type f -name "*.xib" -exec ibtool --sdk "" --change-target-runtime IBIPadFramework {} --write {} \;

I hope posting it here will be of help to others with similar problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜