Posted By Our Mentors
Amreen Khan
Android Developer
animesh bansal
iphone App Developer
Devendra chouksey
Android Developer
Dilip Saket
IOS apps developer
Hemraj Jhariya
iOS Developer
Jaihind singh Rajput
Smart Phone App Dev
Mujahid khan
Android developer
Narendra Yadav
android developer
Narinder Gupta
Mobile App Architect
Pradeep singh Thakur
Mobile App Architect
Sanjay Sharma
Andriod Developer
Shakti Rajpal
IT Architect
Soniya Vishwakarma
iPhone App Developer
Sunil Raghuwanshi
iPhone App Developer
Supriya Kapse
Senior developer
Why Fat Xibs Needs To Be Avoided Iphone/iPad
Generally using XIB is a good practice when we are on the stage of learning iOS application development. As an experience developer we should avoid using the XIBs to designing views in the application.
Posted By: Dilip Saket Date: 13 Jan 2014 View: 1408
      Rate This !!


Development procedure includes various pitfalls no matter it is for iOS or other. With iOS development, a developer encounter with various ups and downs and sometimes a great exertion to cope with when trapped somewhere. These might be to come up from memory issues, designing or other kinda related and XIBs are among them.

Usually known as Interface builder tool, IB can be used to design user interfaces visually. These interface definitions created by IB can be further saved in xib files. In IOS application development we should avoid these XIBs in our application. XIB is an extra file in the application which takes extra time to load in application. When we load a XIB into memory, all of its contents are loaded into memory, including images. A view controller's XIB loads all the subviews available in XIB if we are using that are not and also load the resources like image into memory. These things make application performance slow due to heavy memory usage. In loadView method, application takes more time to load view of view-controller while using a fat XIB. 

Image loading process in XIB cache the images entirely. ImageNamed caches your images and you lose control over the memory - there's no guarantee that releasing the object will actually release the image but does provide faster loading of images second time around as they are cached. If you are using Interface Builder, and setting the image in Image View Attributes, that is also equal to imageNamed method. The image will be cached immediately when the app is ran.

If we are not using XIB we have an option to load image without caching. We can load image by using UIImage class method "imageWithContentsOfFile:" which will not cache the image itself. It will get the image from the main bundle on the application and will not increase the CPU memory use like imageNamed: method.


Posted Queries