Archive

Posts Tagged ‘Tutorial’

Sparrow 0.9: New Xcode Templates

August 11th, 2010 Ronald Mathies 3 comments


Sparrow has released a new version of their game development framework. This release

Logo Sparrow Framework

contains some really great features among the most important:

  • Performance improvements!
  • Support for high resolution screens
  • Texture atlas generator
  • Some other medior and minor changes

For a complete list and code samples check out their over at:

No chicken: Sparrow 0.9 is out!

I have also updated the project and file templates for Xcode to include support for the 0.9 release. The following changes have been made:

  • Compatible with Sparrow Version 0.9
  • Changed installation method to using an Installer instead of extracting and installing it yourself.
  • Added iOS4 Compatibility for multitasking (as described in de Blog: Multitasking )
  • Changed base SDK and default deployment target to

Read more >

  • Add to favorites
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Slashdot
  • Tumblr
  • Twitter
  • FriendFeed
  • Facebook
  • Google Bookmarks
  • MySpace
  • Faves

Objective-C: Detect when running on iPhone or iPad

July 26th, 2010 Ronald Mathies No comments

Apple has introduced a new macro which enables you to detect if you are running on a iPhone or on a iPad. The USER_INTERFACE_IDIOM() macro will return either UIUserInterfaceIdiomPhone or UIUserInterfaceIdiomPad corresponding to the device that it is running on.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// Running on a iPad
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
// Running on a iPhone
}

The check can be used in the following way, since it is used at runtime you can use this check for example to generate a different UI for both the iPad / iPhone.

  • Add to favorites
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Slashdot
  • Tumblr
  • Twitter
  • FriendFeed
  • Facebook
  • Google Bookmarks
  • MySpace
  • Faves
  • Add to favorites
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Slashdot
  • Tumblr
  • Twitter
  • FriendFeed
  • Facebook
  • Google Bookmarks
  • MySpace
  • Faves

Objective-C: Detect when running in Simulator or on Device.

July 13th, 2010 Ronald Mathies No comments

Sometimes it can be convenient to be able to detect when you are running inside the simulator or when you are running on a device. For example, suppose you have a service which supplies data it might be useful when you want to retrieve data from a testing server instead of the production server when you are running in the simulator.

The check below works for both the iPhone / iPad, however, keep in mind that this is only a compile time check, so the code included in the binary depends on your compile target.

The detection mechanism is very simple:

#if TARGET_IPHONE_SIMULATOR
  // We are running inside the simulator
#else
  // We are running on a device
#endif

If you only want to check if you are running on a device you can use the following mechanism:

Read more >

  • Add to favorites
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Slashdot
  • Tumblr
  • Twitter
  • FriendFeed
  • Facebook
  • Google Bookmarks
  • MySpace
  • Faves

Objective-C: Check for Wifi connection and keeping Wifi alive.

July 13th, 2010 Ronald Mathies 2 comments

When you are creating an iPhone / iPad application that requires a Wifi connection, or when you want to change your applications behavior when you are working on a Wifi connection or 3G connection you need to be able to check if you are connected to a Wifi network.

Behavior difference can for example be if you want to retrieve the ten latest headlines or fifty latest headlines, a Wifi connection can be fast enough to retrieve more data in the same time window as you would using a 3G connection, which could enable a better user experience.

The following code samples require the use of the Reachability class provided by Apple, you can download the class from the following location:

Reachability code

The following code sample checks for the existence of a Wifi connection:

if ([[Reachability reachabilityForLocalWiFi] currentReachabilityStatus]
    ==

Read more >

  • Add to favorites
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Slashdot
  • Tumblr
  • Twitter
  • FriendFeed
  • Facebook
  • Google Bookmarks
  • MySpace
  • Faves