Friday, October 18, 2013

Introduction to ViewController in iOS

We follow MVC Pattern for development of iOS Application. Visit MVC Overview article on wiki to have a brief introduction to the pattern. It has been consumed neatly to implement the iOS applications.

ViewController Life Cycle

Life Cycle define how an object is created an lay out the different kind of stages it pass through before it gets to the end of the life cycle, also on course of the life it send different kind of events which other objects can observe. So what are different methods are involved in the ViewController life cycle? here is the brief introduction to each of them...
  • initWithNibName:bundle - Default Initializer of the view controller.
  • LoadView - Loads the view from the storyboard or the nib file.
  • viewDidLoad - After Initialization and all the outlets are set.
  • viewWillAppear - Called just before the view appear on the screen,.
  • viewWillDisappear - Called before the view disappear from the screen.
  • viewDidAppear and viewDidDisappear - After the view appear and disappear from the screen

Types of controller Objects

In Cocoa there are two types of controller objects. 
  • Mediating Controllers
  • Coordinating Controllers
Each controller is associated with different type of classes and provide different type of Behaviors.

Mediating Controllers

It is an Object that inherit from NSController class. These are used in the Cocoa binding technology. Mediating Controllers mediate the flow of data between the view objects and the model objects. 

Mediating controllers are generally controllers which we drag from the Interface Builder Library. You can configure these to establish binding between the view objects and the properties of the controller object. The abstract class NSController and its concrete subclasses NSObjectController, NSArrayController etc. provide features like supporting commit and discarding the changes.

Coordinating Controllers

A Coordinating Controller is typically an NSWindowController or NSDocumentController objects or Instance of a custom subclass of NSObject. Its role is to coordinated the functionality of the overall application or a part of the application. A coordinating controller provide features like:
  • Respond to Delegation messages or observing notifications
  • Respond to action messages
  • Managing the life cycle of owned objects.
  • Establishing connections between objects.
Instance of Custom NSObject subclass can be entirely suitable as coordinating controller. These kind of controller objects combine both mediating and coordinating functions. For mediating behavior they use mechanisms such as outlets, delegation, and notifications of the movement of data between view and the model. 

Just an overview of the controllers in iOS.

Happy Coding!!!

Wednesday, October 16, 2013

What's New in XCode 5 Part 3

What's New in XCode 5 Part 3

This is part 3 of the Series What's New in XCode 5. In Part 2 we had discussed what's new in
  • Interface Design
  • Compiler and Language
  • Auto Vectorizer
  • Parsing the Comments
XCode 5 is so fast and stable as the transition from GC to ARC has be completed with XCode 5... :) It has been 2 years since ARC has come into picture and has been great thing happen. Apple has announced that GC is deprecated technology and those developers who are using GC in Mac should switch to ARC and they will notice the change. Besides this enhancement there are still other features which we need to discuss..

XCode Debugger

Similar to Compiler XCode supported two different Debuggers "LLDB" and "GDB". Now with XCode 5 only LLDB debugger is available and gdb is gone. New features of debugger are:

Monday, October 14, 2013

What's New in XCode 5 Part 2

What's New in XCode 5 Part 2

In Part 1 of this series we had discussed about:
  • Documentation
  • Performance
  • SourceControl
  • Automatic Configuration
in XCode 5. Today we will discuss about more in features of XCode 5.

Monday, October 7, 2013

What's New in XCode 5 Part 1

What's New in XCode 5 Part 1

As we all know that iOS 7 has been the major release of iOS and it has brought us developers so many cool features. iOS 7 What's a new link to know more about it.

iOS 7 release brings the release of iOS 7 SDK and XCode 5, iOS 7 SDK and Xcode 5 download is available. Once you download and Installed XCode 5 you must be wondering now what's new in this... Right? That's what we are going to discuss in this very Blog.. and of course as IDE XCode do a lot of things and you know being a programmer it won't be easy to explain all the things in place. :) So I will be writing series of blogs to cover the features and this is the Beginning.. :) 

So What's New in XCode 5? Here are features:

Sunday, October 6, 2013

TypeCasting objects in Objective C

Type Casting

Type Casting a process converting one type of object to another type of object. Every language a semantics of TypeCasting. Today we will discuss about type casting in Objective C.

E.g We have two class BaseClass and DerivedClass.



@interface BaseClass : NSObject
@property (nonatomic,strong) NSString *baseProperty;
-(void)baseMethod;
@end