Pages

Crucial facts about iOS app development

1. Hiding the Status Bar of the ios simulator:

When you are designing an application that uses the table view or content view then the very basic situation you will fell into is the table or content view is colliding with the status bar of the ios simulator, then to remove it the function you will be using is:
---->>   override func prefersStatusBarHidden() -> Bool {
                                return true
                   }

 What this function do is hide the status bar of the ios simulator for you by returning "true". If this function will return value "false". The status bar will not be hidden it will be as good as not to use this function.

2. Applying Gestures on the Buttons:

When you apply gestures on the UIButtons they will be applied easily. But do you know that you can't apply gestures on the UIBarButton Items, yah! that's right, You can't apply gestures on the UIBarButtonItems.
If you do you will definitely get an error like :-->"UIBarButtonItem does't have a property Gesture".Well of course if you want to apply on the UIButton then here is an piece of advice: Register these gestures in the viewDidLoad() function so that they will be registered on any button just at the time when View will be loaded at the first time. If you register in any action related to the button then when you click on that button these gestures will be registered on the 1st tap && no meaningful work will be done, then when you will tap on the button second time the Selector handler function will be called.

3. Properties of navigation bar:

The navigation item of every view controller can display two types of content in the title

area of the view controller to which it is assigned:
a.) Simple Text
b.) && A View

A simple text property will show only the text or you will basically called this "title". But if you want to display an image or any other view on the navigation bar then you can use the property of the navigation item that is "titleView" , You can assign any type of property (AnyObject) that is simply a subclass of the  UIView like images etc.

But with this title view as property of navigation Item of view controller there are certain limits of the size of the view that you gonna be using. The height should be of 128 points of any view that you will be showing on the  titleView. 

4. Do you know that why we are using force unwrapping symbol after any property you are declaring inside the class but outside every function for example:

   var textField: UITextField!      or        var button: UIButton!

well guys the reason behind this is that whenever you are declaring any property outside any function (globally) then Swift allow that you can pass only those properties to the functions that are already initialized so by using exclamation symbol after any property we are telling the compiler that "don't worry this property has certainly a value && is not nil"