Skip to main content

Posts

Showing posts from August, 2015

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 ]; } edgesForExtendedLayout This property tells which sides of your view can be extended to cover the whole screen. If you push a UIViewController  into a UINavigationContro

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