• Call us: +91 9501707741
  • tutorialzdiary@gmail.com


iOS Tutorials

Chapter 1: Introduction
Chapter 2: What is iOS ?
Chapter 3: MVC Coding Pattern
Chapter 4: Basics of Swift & Objective C
Chapter 5: Objective C Fundamental
Chapter 6: Swift Language
Chapter 7: Swift 2.0
Chapter 8: iOS Development Basics
Chapter 9: App Store Process
Chapter 10: Github
Chapter 11: Conclusion

iOS Installation

Part 1: Xcode Setup

iOS Interview Questions and Answers

Part 1: iOS Basics
Part 2: Objective C
Part 3: Web Services
Part 4: Database
Part 5: XCode & Framework

iOS Hands on

Sample 1: iOS App

Part 1: iOS Basics

Question: What’s fast enumeration?
Answer: Fast enumeration is a language feature that allows you to enumerate over the contents of a collection. (Your code will also run faster because the internal implementation reduces message send overhead and increases pipelining potential.

Question: What’s a struct?
Answer: A struct is a special C data type that encapsulates other pieces of data into a single cohesive unit. Like an object, but built into C.

Question: What is mutable and immutable type in Objective C?

Answer: Mutable means you can change its contents later but when you mark any object immutable, it means once they are initialized, their values cannot be changed. For example, NSArray, NSString values cannot be changed after initialized.

Question: What is retain counts?
Answer: Retain counts are the way in which memory is managed in Objective C. When you create an object, it has a retain count of 1. When you send an object a retain message, its retain count is incremented by 1. When you send an object a release message, its retain count is decremented by 1. When you send an object a autorelease message, its retain count is decremented by 1 at some stage in the future. If an objectʼs retain count is reduced to 0, it is deallocated.

Question: What’s the difference between frame and bounds?
Answer: The frame of a view is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within. The bounds of a view is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).

Question: Is a delegate retained?
Answer: No, Maximum times (Except CAAnimation)!

Question: Outline the class hierarchy for a UIButton until NSObject.
Answer: UIButton inherits from UIControl, UIControl inherits from UIView, UIView inherits from UIResponder, UIResponder inherits from the root class NSObject.

Question: What is dynamic?
Answer: You use the @dynamic keyword to tell the compiler that you will fulfill the API contract implied by a property either by providing method implementations directly or at runtime using other mechanisms such as dynamic loading of code or dynamic method resolution. It suppresses the warnings that the compiler would otherwise generate if it can’t find suitable implementations. You should use it only if you know that the methods will be available at runtime

Question: What is difference between Copy and mutableCopy ?
Answer: Below is the difference between copy and mutableCopy.

● copy always creates an immutable copy.
● mutableCopy always creates a mutable copy.

Question: What is difference between Strong and Weak?
Answer: Below is the difference between Strong and Weak.

● The strong and weak are new ARC types replacing retain and assign respectively.
● Delegate and outlets should be week.
● A strong reference is a reference to an object that stops it from being deallocated. In other word it creates a owner relationship
● A weak reference is a reference to an object that does not stops it from being deallocated. In other word it creates a owner relationship

Question: Difference between Copy , assign and retain?
Answer: Assign is for primitive values like BOOL, NSInteger or double. For objects use retain or copy, depending on if you want to keep a reference to the original object or make a copy of it.

assign: In your setter method for the property, there is a simple assignment of your instance variable to the new value, eg:

string = newString; }

This can cause problems since ObjectiveC objects use reference counting, and therefore by not retaining the object, there is a chance that the string could be deallocated whilst you are still using it.

retain: this retains the new value in your setter method. For example:

This is safer, since you explicitly state that you want to maintain a reference of the object, and you must release it before it will be deallocated.

[newString retain];
 string = newString;


copy: this makes a copy of the string in your setter method:

This is often used with strings, since making a copy of the original object ensures that it is not changed whilst you are using it.

 string = [newString copy];



Question: Difference between alloc and new?
Answer: “alloc” creates a new memory location but doesn’t initializes it as compared to “new”.

Question: Difference between release and pool drain?
Answer: “release” frees a memory. “drain” releases the NSAutoreleasePool itself.

Question: Difference between autorelease and release?
Answer: Autorelease: By sending an object an autorelease message, it is added to the local AutoReleasePool, and you no longer have to worry about it, because when the AutoReleasePool is destroyed (as happens in the course of event processing by the system) the object will receive a release message, its Retain Count will be decremented, and the Garbage Collection system will destroy the object if the Retain Count is zero.

Release: retain count is decremented at this point.

Question: How to implement the following methods: retain, release, autorelease?



NSIncrementExtraRefCount(self); return self;


{ if(NSDecrementExtraRefCountWasZero(self)) { NSDeallocateObject(self);




{ // Add the object to the autorelease pool [NSAutoreleasePool addObject:self]; return self }

Question: Multitasking support is available from which version?
Answer: iOS 4 and above supports multitasking and allows apps to remain in the background until they are launched again or until they are terminated.

Question: How many bytes we can send to apple push notification server.
Answer: 256 bytes.

Question: What is the difference between retain & assign?
Answer: Assign creates a reference from one object to another without increasing the source’s retain count.

if (_variable != object) {

[_variable release]; _variable = nil; _variable = object;


Retain creates a reference from one object to another and increases the retain count of the source object.

if (_variable != object)

{ [_variable release]; _variable = nil; _variable = [object retain]; }

Question: What is categories in iOS?
Answer: A Category is a feature of the ObjectiveC language that enables you to add methods (interface and implementation) to a class without having to make a subclass.There is no runtime difference—within the scope of your program—between the original methods of the class and the methods added by the category. The methods in the category become part of the class type and are inherited by all the class’s subclasses.As with delegation, categories are not a strict adaptation of the Decorator pattern, fulfilling the intent but taking a different path to implementing that intent. The behaviour added by categories is a compile time artefact, and is not something dynamically acquired. Moreover, categories do not encapsulate an instance of the class being extended.

Question: What is Delegation in iOS?
Answer: Delegation is a design pattern in which one object sends messages to another object—specified as its delegate—to ask for input or to notify it that an event is occurring. Delegation is often used as an alternative to class inheritance to extend the functionality of reusable objects. For example, before a window changes size, it asks its delegate whether the new size is ok. The delegate replies to the window, telling it that the suggested size is acceptable or suggesting a better size. (For more details on window resizing, see thewindowWillResize:toSize: message.)Delegate methods are typically grouped into a protocol. A protocol is basically just a list of methods. The delegate protocol specifies all the messages an object might send to its delegate. If a class conforms to (or adopts) a protocol, it guarantees that it implements the required methods of a protocol.

Question: How can we achieve singleton pattern in iOS?
Answer: The Singleton design pattern ensures a class only has one instance, and provides a global point of access to it. The class keeps track of its sole instance and ensures that no other instance can be created. Singleton classes are appropriate for situations where it makes sense for a single object to provide access to a global resource. Several Cocoa framework classes are singletons. They include NSFileManager, NSWorkspace, NSApplication, and, in UIKit, UIApplication. A process is limited to one instance of these classes. When a client asks the class for an instance, it gets a shared instance, which is lazily created upon the first request.

Question: What is delegate pattern in iOS?
Answer: Delegation is a mechanism by which a host object embeds a weak reference (weak in the sense that it’s a simple pointer reference, unretained) to another object—its delegate—and periodically sends messages to the delegate when it requires its input for a task. The host object is generally an “offtheshelf” framework object (such as an NSWindow or NSXMLParserobject) that is seeking to accomplish something, but can only do so in a generic fashion.


Training Enquiry