Skip to main content


Blocks From one Class to Another

One popular scenario in using blocks is when you need to update your view after a web service call is finished.
Recent posts

Blocks in Web Service Functions

Hi Everyone! It has been a very long while since I last posted in this blog. This time, I will be making a tutorial in using blocks when we are accessing our API or web services. Disclaimer: I am also not that 'expert' when it comes to blocks. But I have learned this method throughout my career as an iOS Developer. This is a combination of what I learned from my senior teammates. By the way, I am using the AFNetworking Framework. Set up... 1. Create a singleton-patterned APIClient class which is a subclass of AFHTTPClient. 2. Our APIClient interface file should look like this... #import <Foundation/Foundation.h> #import   "AFHTTPClient.h" @interface  APIClient : AFHTTPClient + ( APIClient *)sharedClient; @end 3. And in our implementation file: #import   "APIClient.h" #import   "Constants.h" @implementation GCAPIClient /** We usually have our Development and Production API links, right? So to cate

UISplitViewController Landscape

Tutorial Request from Mazrizan Kamisan We'll have the portrait view in another tutorial which will be a continuation of this landscape tutorial of UISplitViewController. /* Note: This works in OS versions greater than or equal to iOS 6.0 OS versions less than iOS 6.0 has a different look in its UIPopoverController and doesn't support Landscape Orientation.*/ I studied UISplitViewController by creating a Master Detail Application Template. For sure, you will also be able to understand by looking at its code. For those who want to do it themselves (not just merely creating a Master Detail Application), just follow this tutorial. 1. Create an Empty Application Template. Select iPad for our Device Family. 2. Add a New File, subclass of UITableViewController, check "With XIB for user interface." This is the view on the left area of our application. 3. Create another File, subclass UIViewController. This is for the bigger area (right panel) of our appli

UISplitViewController Portrait

/* Note:  This works in OS versions greater than or equal to iOS 6.0 OS versions less than iOS 6.0 has a different look in its UIPopoverController and doesn't support Landscape Orientation.*/ Please do continue from where we left off in our  UISplitViewController Landscape Tutorial ... 1. Add <UISplitViewControllerDelegate> in PopMenuDetailViewController interface header. 2. Add UIPopoverController property in PopMenuDetailViewController interface Section. @property ( strong , nonatomic ) UIPopoverController *masterPopoverController; Synthesize this property: @synthesize masterPopoverController; By the way, UIPopoverController is only available in iPad. If you want to make something like this in your iPhone application, you may use third party libraries like WEPopoverController. Download it from github . 3. Copy these SplitView Delegate methods in our PopMenuDetailViewController.m file. 4. I n AppDelegate.m file, add this one-line c

3.5 and 4-Inch Screen Compatible

Now that iPhone 5 is in the market, we have to make sure that our apps are compatible to both 3.5-inch screens and 4-inch screens. That's easy!  Just check the "Use Autolayout" in our Interface Builder and it will automatically make our 3.5-inch screens compatible to 4-inch screens. Now, wait! "Use Autolayout" is useful if the minimum OS requirement is iOS 6 and up. What if your application's minimum OS requirement is, for example, iOS 4.3 and up? You can't use the "Use Autolayout" because your app will definitely crash if you run it in <iOS 6 devices (even in your simulator).  This is what will happen if you use Autolayout and you're running your app in < i0S 6 The Good News is we have a simple solution for that! 1. First, I created a simple "Single View Application" project. View size is set to Retina 3.5 Full Screen. Here's how my simple app looks like. No functions, just a simple user interfa

SQLite Tutorial Part 2

Credits: Most of the codes are from  Techotopia  and I refer this tutorial from their  SQLite tutorial  For more information and detailed discussion, refer to their site. :D This will be a continuation of our first SQLite Tutorial . We will only edit our previous project so I suggest you go over with SQLite Tutorial Part1 first. Delete the SQLite Tutorial app in your device / simulator since we are going to change the database. Delete the derived data of SQLiteTutorial on your Organizer (upper-right corner of Xcode IDE). We will be covering the following topics: 1. Having multiple columns in our table named "SAMPLETABLE". 2. Getting all data in SAMPLETABLE (with multiple columns) 3. Search and return data from our SAMPLETABLE. 1. Let's edit our ViewController.xib such that we can enter information of a person. Change the "keyboard type" of the textfield "Year" so that the user can only input numbers. 2. Create IBOutlet proper