Developing iPhone app to Run on iPad - Auto Set 2x

懵懂的女人 提交于 2019-12-19 19:29:33

问题


Is there a way to programmatically set the iPad to run the iPhone app at 2x as it is launched (yet keep the iPhone app native). I understand I can create NIB files for each hardware platform, but for ease, I just would rather the app launch as if the user had tapped the 2x on the iPad. Thanks...R.J.


回答1:


No. The pixel-doubling malarkey is not under your app's control, and is pretty much a crutch for apps that weren't designed for the iPad. If you didn't go nuts with specific pixel measurements in the original code, it shouldn't be difficult to move to the larger screen.




回答2:


It's not quite program control, but you can get an app to start up in 2x mode on iOS 4.2.

I've had a couple of apps that have always started up in 2x mode, and very nice it was too, but I only worked out why this was today!

Steps:

  1. Run iPhone app (e.g., from Xcode)
  2. Use '1x' and '2x' buttons to select desired zoom level
  3. Press home button to get back to launcher
  4. Double tap home button to bring up task manager
  5. Kill your app (hold finger down until icons start to dance, then press the '-' button on your app's icon)

(If you ran under the debugger in step 1, Xcode will tell you the program got a SIGKILL, and might stop somewhere random in the call stack; you can ignore this.)

Now next time you run the program, it will start up with the zoom level you selected in step 2!

I didn't test absolutely every method of closing the program, but this preference doesn't get saved if you stop it from Xcode (e.g., using Run|Stop menu item), and it doesn't get saved if your program terminates using exit. Closing it using the launcher is the only way I've found so far...



来源:https://stackoverflow.com/questions/2680392/developing-iphone-app-to-run-on-ipad-auto-set-2x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!