In iPhone / iPad development, executing code on a thread other than the main UI thread is usually done to keep a long running process from blocking or stalling the user interface. In iOS, there are a couple of ways to perform tasks on new threads. In this blog, we take a look at the simplest of these, NSThread.
In this blog post, we’ll look at the built – in touch gesture recognizers that can be accessed using Interface Builder in Xcode. These gestures include taps, pinches, rotations, swipes, pans, and long presses, which should be sufficient for most developer needs.
An important part of developing with iOS 7 is having a consistent look and feel for our apps. One way this is achieved is through the use of tint. A view’s tint property defines the tint color applied to all of its controls.
Tab bar controllers are used when we need to see more than one view of the same data. In this app, we’ll implement a simple version of an indexing utility, which counts the words in a text sample and orders them by their frequency…
In this blog, we’ll take a new look at table views using Xcode 5 and iOS 7. This new version of iOS is the first to assume that we will be using storyboards rather than nib files, so if you’ve been waiting to adopt storyboards, now’s the time.
In this blog we’ll examine how to create a view object in Interface Builder that is backed by a UIView. We’ll control the view’s color and alpha channel properties by using sliders. The app will demonstrate how to force a view to refresh after a property of it has been changed. So let’s see how […]
In this application we will see how to change the background color using segmentControl, in TabBar Application . So let see how it will worked. Step 1: Open the Xcode, Create a new project using TabBar Base application. Give the application “TabBarWithSegmentControl”. Step 2: Xcode automatically creates the directory structure and adds essential frameworks to […]
Most common issues arises while using UI TextField and UI TextView controls in iPhone (or iPad) development is that of dismissing the keyset when text entry is complete. In this blog, we’ll show you how this is done. Start Xcode, and choose “Create a new Xcode project.” Choose the Single View Application template, and click […]
Suppose if we want to populate the large amount of static data in iOS application then we generally use text view object to represent that data. Text view object is feasible for some situations. But if we want the different font sizes and different font colors to different paragraphs then text view is not at […]
Sometimes we want to perform some task on an object that is not included in the methods of that class. An example of this might be reversing the order of characters in an NSString object. While we could certainly do this in code, it would be better if we could add a class method to […]
In this blog, we’ll see how to use a UIPicker control to implement a simple lottery application. The user will choose a two digit number using a picker control, then press a button to see if their number matches a random number generated by the app. Let’s see how it works! Start Xcode, choose “Create […]
Since iOS version 5, gesture recognizers have been added to the list of controls in the Interface Builder library. But sometimes we want more information about a touch than these handlers can easily provide. Today, I’ll show you a simple way to get the exact duration of a touch on the screen. So let’s get […]
The NSArray class is often used as a container for NSString objects, making it one of the most useful classes in the entire Foundation framework. In addition to providing indexed storage for objects, we can also sort the objects using either a predefined selector or one that we provide ourselves. In this blog, we’ll sort […]
We create a new method getPersonOutOfAddressBook where our most important actions take place.
CFErrorRef error = NULL;
ABAddressBookRef addressBook =
if (addressBook != nil)
NSArray *allContacts = (__bridge_transfer NSArray
NSUInteger i = 0;
for (i = 0; i < [allContacts count]; i++)
Person *person = [[Person alloc] init];
ABRecordRef contactPerson = (__bridge ABRecordRef)allContacts[i];
NSString *firstName = (__bridge_transfer NSString
NSString *lastName = (__bridge_transfer NSString
NSString *fullName = [NSString stringWithFormat:@"%@ %@",
person.firstName = firstName;
person.lastName = lastName;
person.fullName = fullName;
ABMultiValueRef emails = ABRecordCopyValue(contactPerson,
NSUInteger j = 0;
for (j = 0; j < ABMultiValueGetCount(emails); j++)
NSString *email = (__bridge_transfer NSString
if (j == 0)
person.homeEmail = email;
NSLog(@"person.homeEmail = %@ ", person.homeEmail);
else if (j==1)
person.workEmail = email;
A lot is going on here in this method. Let’s walk through the different parts 1. In case of an error we create an error object. We get a reference to the user’s address book. 2. we copy all contacts from […]