Skip to main content

Posts

UIViewController view is overlapped with the Navigation and Status bar

Background: Since iOS7 release status bar is part of your  the view. It is the common problem faced in application that navigation and status bar overlapped with your view content when you use nib or xib files.                 XIB                                          Actual result I have seen in some application that to fix this problem view content is start from 64 pixel down. But it can raise other problem in the applications. So question is: How To Fix This ? Solution 1: In View did load you can add the following line: [ self setEdgesForExtendedLayout : UIRectEdgeNone ]; Example: - ( void )viewDidLoad {     [ super viewDidLoad ];     // Do any additional setup after loading the view, typically from a nib.     [ self setEdgesForExtendedLayout : UIRectEdgeNone ]; ...

How to Handle Multiple Asynchronous Response (Wait to complete All)

Background : Suppose you are developing an application and you need to hit multiple Asynchronous request at a time. Now you are waiting for the responses from all the request to be complete. Question is When you received any response in a delegate, callback or Completion block, how to ensure whether all the request is completed or not ? There can be many ways to do this. I am explaining here two ways to handle this: 1) Use a simple Counter (Preferred for same type of request) 2) Use a enum with Bitwise Method Logical Explanation: Use a simple Counter: In this approach we need to use a counter. For every request we will increase the counter by 1 and when we receive the response, decrement it by 1. This approach is good if we have only one type of request. Like image downloading for gallery. In this approach we cannot differentiate that which request is completed or which is not. Use a enum with Bitwise Method In this approach we will use enum to keep t...

How Cross Platform works in native world

Cross Platform: Cross platform means here single application or codebase run on multiple mobile platform(iOS, android). Today most of the organization focusing on mobile world. When an organisation take first step in the domain the very first question in there mind is. Should i go with native development or cross platform? There Decision based on the some factors Native (Pros):  1) Native Look and feel 2) High Performance 3) No restriction over device capability (Like camera, Bluetooth) etc and Many more Native (Cons): 1) More resources require to develop native application. i.e more money 2) Training require for each platform. CrossPlatform (Pros): 1) Developer need to know only single technology or language (Javascript and Html).  2) Less resources require for developing and maintaining application. 3) Distribution can be done like other native apps (App store, Play store)      CrossPlatform (Cons): ...

Deep Diving Objective-C Properties (Part 2)

Previous post of properties explained about the lifetime qualifiers. Today post will have exciting stuff about the other qualifier and some concepts about where to used these qualifier. Threads and Properties: Suppose you are working in multithreaded environment and two thread want to access the same property at same time. Thread A want to write and thread B is in middle of reading the property name.  What happen which value thread B will get. ? There are two qualifier which decide the behaviour in such condition. 1)  atomic (Default) 2) nonatomic Atomic: 1) Default behaviour. 2) Ensure that one thread will access property or method at a time. (Inconsistency will be not there as atomicity). Thread B will get autorelease value always in the above case. 3) Does not ensure the thread safety of instance variable. Any other thread can access the instance variable bind to property. So instance variable in not thread safe ...

Deep Diving Objective-C Properties (Part 1)

Properties Properties in objective c are a convenient way to provide the accessors (getter and setter) for instance variable in objective - c language. Let suppose you have a mobile then what are its properties? Name: Brand Name: Screen Size: etc. So properties define the things. In a similar manner properties in objective - c define the class or objects. A Simple Example for a Person class with the basic attribute. Example:  @interface  Person :  NSObject @property   NSString * name; @end Compiler will generate 
a getter and setter for you with the following convention: - ( void ) setName:( NSString *)name{     //Compiler generated the code for getter property } - ( NSString *)name{         //Compiler generated the code for getter property } From the above code there are some questions raised in mind? 1) W...