iOS Developer Tips - Visitor Stats:
276,807 Pageviews and 214,652 visitors in the past 30 days.

For advertising information and rates, click here.

Remind Users to Restart Your App

Posted on February 8, 2012 by John Muchow in Core Services. No comments posted.

This tip shows you how to create a local notification that will be trigged when a user exits your application. I would recommend you use this sparingly, for example, if the user was in the middle of setting up configuration information needed by an application.

Let’s start with a quick look at how this appears to the user. Assume the application TestApp is running in the foreground. When the application is put into the background by pressing the home button, within 1 second (see the code below), the following local notifications will appear (iOS 5 and iOS 4):

Continue reading this post »

Debugging with GDB: Print-Object and UIView recursiveDescription

Posted on January 30, 2012 by John Muchow in Debugging. 2 comments posted.

In the post Debugging with GDB: Introduction to Commands, Print and Print-Object I covered the basics of the command line inteface in GDB. In this post I’ll show you a trick to print out the entire view hierarchy for UIView objects.

In Objective-C, all objects (derived from NSObject) have a description method, which returns an NSString describing the object. When using GDB, you can print the description using print-object, for example, let’s use the interface definition below to look at a few descriptions:

Continue reading this post »

Updated: Tracking Down EXC_BAD_ACCESS Errors with NSZombieEnabled in Xcode 4

Posted on January 26, 2012 by John Muchow in Debugging. 5 comments posted.

In a previous post Tracking Down EXC_BAD_ACCESS Errors with NSZombieEnabled I explained how the environment variable NSZombieEnabled can help track down EXC_BAD_ACCESS errors, which are typically caused by attempting to access objects that have already been released.

With Xcode 4 the process for setting NSZombieEnabled is different than in earlier versions of Xcode. To configure zombies, enter ⌥-⌘-r (alt-command-r). Once the dialog is shown, choose the option Enable Zombie Objects

Continue reading this post »

Delete All Files in Documents Directory

Posted on January 16, 2012 by John Muchow in Data / File Management. No comments posted.

In a recent project, I was using iTunes File Sharing to store various log files and test data. Although you can quickly delete all the files in the Documents directory using iTunes, I also was looking for a way to clean up the same directory when my device was not connected.

The first approach I took was to loop through all the files, building a path to each, one by one:

Continue reading this post »

iOS Open Source : SVProgressHUD Heads Up Display

Posted on January 13, 2012 by John Muchow in Open Source. 2 comments posted.

Although I’ve covered HUDs previously, Sam Vermette has done a nice job with his design and implementation. I like Sam’s approach, the methods for displaying and dismissing heads-up-displays are class methods – this is a nice touch in that you don’t need to worry about allocating and releasing objects.

There is an abundance of interesting code in the project, including numerous block animations. Many of the little things Sam has already dialed in – for example, the size of an HUD is dynamically adjusted when displaying text, the longer the text, the wider the view (and support for wrapping text works out of the box).

Continue reading this post »

Debugging with GDB: Introduction to Commands, Print and Print-Object

Posted on January 10, 2012 by John Muchow in Debugging. 3 comments posted.

GDB is the debugging system built into Xcode. Xcode handles much of the interaction with GDB to provide support for breakpoints, stepping through/over code, wowever, GBD also provides a command line that you can use to work directly with the debugger. This tutorial walks through the basics of the command line interface along with an introduction to a handful of commands for viewing variable and object data.

The first thing to understand is that commands can only be entered into GDB when the debugging process is stopped, which is done via breakpoints. If you hit a breakpoint, the debug console will look as follows:

Continue reading this post »

iOS Open Source : Doorway Transition with CoreAnimation

Posted on January 6, 2012 by John Muchow in Open Source. 1 comment posted.

Ken Matsui has written a unique transition for moving between views that I want to share with you – the effect is similar to sliding open two doors, with the following view moving toward the front of the display in a smooth, sliding motion.

The images below show the basic idea, however, you owe it to yourself to download and run the demo project to get the full effect.

Continue reading this post »

iOS 5 : Customize UINavigationBar and UIBarButtonItem with the Appearance API

Posted on January 2, 2012 by John Muchow in User Interface. 2 comments posted.

In a previous post, UIImage and resizableImageWithCapInsets, I explained how to use the method resizableImageWithCapInsets in a UIImage object to set cap insets, which specify areas of an image that are not to be changed when resizing or scaling an image. That post was a segue to this post, which will use images (and cap insets) as part of the iOS 5 appearance API and customizing the navigation bar.

Change UINavigationBar Background

With the release of iOS 5, the UIAppearance protocol is used to access the appearance proxy for a class you would like to configure. Customization is done by sending messages to the target class appearance proxy. When changing the appearance of an object, all instances of the object can be updated or only specific instances within a container class.

Let’s see how this looks as it relates to updating the background color of a UINavigationBar, it’s text and the back button which will allow a user to return to a previous view controller.

Continue reading this post »

Get List of Installed International Keyboards

Posted on December 27, 2011 by John Muchow in Core Services. 2 comments posted.

The NSUserDefaults object is typically used to save/restore your application related preferences, configuration data, etc – see Write and Read User Preferences for more information. In addition to application specifics, there is a system wide default list that is available to all applications, accessible using the class method standardUserDefaults in the NSUserDefaults object.

To get a list of the system wide settings:

NSDictionary* defaults = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
NSLog(@"Defaults: %@", defaults);


Continue reading this post »

iOS 5 : UIImage and resizableImageWithCapInsets

Posted on December 20, 2011 by John Muchow in User Interface. 4 comments posted.

I recently began writing a short example to learn more about the iOS 5 Appearance API and customizing UINavigationBar objects. The goal was to add a custom background, title and text to the navbar. Once I had this working, to keep a consist look across my application, I began tweaking the buttons on the navbar using the same Appearance API.

As I got further into the customization of the buttons, I ran into a method within UIImage that was introduced in iOS 5, resizableImageWithCapInsets. I found myself getting side-tracked from the original idea of navbar look and feel, to understanding how cap insets work. This post delves into what I learned.

Continue reading this post »

Suggestions for iOS Developer Books, Tools and Software Giveaway

Posted on December 15, 2011 by John Muchow in Giveaway. 8 comments posted.

Starting in January of 2012, I’d like to offer givewaways a few times each month, with the focus on iOS related development tools, software, books or other media. I haven’t figured out all the details, however, the basic idea would be to post something mid-week about the giveaway, gather entries for two days, announcing the winner on the following Thursday.

Continue reading this post »

Xcode 4 : Show Invisibles to Find Tabs and Spaces

Posted on December 14, 2011 by John Muchow in Xcode. No comments posted.

Every now and again I experience some rather odd code formatting behavior when I copy/paste from Xcode into another editor, an email or this blog. I’m never quite sure just where the weirdness originates, most likely an errant tab that was inadvertently introduced somewhere on the way.

For example, this screenshot from Xcode looks rather innocuous:

spacer

Continue reading this post »

iOS 5 : Look Up Definitions Using Dictionary Service

Posted on December 12, 2011 by John Muchow in Core Services. 4 comments posted.

With iOS 5, there is now a dictionary service that you can access to look up definitions of words. UIReferenceLibraryViewController makes it as easy as creating an instance of the class and providing a term/word to lookup. The view controller will handle the display of the definition and managing the UI (scrolling, etc).

// Create the view controller
UIReferenceLibraryViewController *reference = 
  [[[UIReferenceLibraryViewController alloc] initWithTerm:@"homebrew"] autorelease];
 
[self presentModalViewController:reference animated:YES];
}

spacer

Continue reading this post »

iOS Open Source : Non-Rectangular Button Shapes

Posted on December 9, 2011 by John Muchow in Open Source. No comments posted.

Ole Begemann has created an interesting control for creating non-rectangular shaped buttons, OBShapedButton. Although UIButton can use images of various shapes, one key benefit of OBShapedButton is that a button of this type will only respond to touches in the areas of the button image that is visible.

The demo project included shows how OBShapedButton differs from a standard button, as the figure below indicates:

spacer

Continue reading this post »

Sponsor: App Design Vault

Posted on December 6, 2011 by Sponsor in Announcements. No comments posted.

Editor’s Note: The following post was written and submitted by App Design Vault, a sponsor of iOS Developer Tips.

With over half a million Apps in the App store, it is no more the wild west where you can throw up any kind of app and succeed. The App store is now a mature place of business and your apps need to stand out from the sea of apps for it to be a success.

One way to make your apps stand out is to have a custom design. Having a well-designed app makes it look professional and buyers will choose to download it instead of your competitors’ apps. The feel of professionalism will make your buyer know you are in business and not just some hobby coder.

Continue reading this post »

Next Page
All Content Copyright © 2008-2012 • iOS Developer Tips, All Rights Reserved.
 
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.