Showing posts with label alloc. Show all posts
Showing posts with label alloc. Show all posts

Monday, 3 March 2014

UIFont Class Reference

Overview

The UIFont class provides the interface for getting and setting font information. The class provides you with access to the font’s characteristics and also provides the system with access to the font’s glyph information, which is used during layout. You use font objects by passing them to methods that accept them as a parameter.
You do not create UIFont objects using the alloc and init methods. Instead, you use class methods of UIFont, such as preferredFontForTextStyle:, to look up and retrieve the desired font object. These methods check for an existing font object with the specified characteristics and return it if it exists. Otherwise, they create a new font object based on the desired font characteristics.
Font objects are immutable and so it is safe to use them from multiple threads in your app.

Read more: https://developer.apple.com/library/ios/documentation/uikit/reference/UIFont_Class/Reference/Reference.html

Wednesday, 1 May 2013

View Controller Lifecycle

View Controllers are the controllers of your MVC. They have a Lifecycle. (They are created, do some task and they die.)

There are certain methods in view controller which notify you of what's going on. View controller can be created by alloc init by 99% of time MVCs are instantiated out of a story board.

Put set up codes for your view in viewDidLoad:

-(void) viewDidLoad{

 [super viewDidLoad];


}

But remember geometry is not set in viewDidLoad. You can do it in viewWillAppear:


-(void)viewWillAppear: (BOOL)animated;


Your view will only load once, but it may appear and disappear few times.
If your things you are displaying is changing while your app is off screen, you should add the code to viewWillAppear.


didRecievedMemoryWarning

In low memory situation, didRecievedMemoryWarning is called. It is very rare to happen, but if it happens you can set the pointer of the object that causes it to nil and reload your data. Keep in mind to use caching in your program where it makes sense.

awakeFromNib 

This message is sent to every single object that comes out of the story board. It happens before the MVC is loaded and before all the outlets are set.
written by: infinitywebseo