Friday, June 1, 2012

UIScreen Features and its good use .

Hi :)


We can use the UIScreen features at many places in the application.
What does UIScreen do.
UIScreen is equivalent to the device's internal screen.
It simply returns the info about our device screen.

For example if you go to Console and find output for the following things
CGRect bounds1=NSStringFromCGRect([[UIScreen mainScreen] bounds]); //Returns bounds of the iphone screen.
CGRect  bounds2=  NSStringFromCGRect([[UIScreen mainScreen] applicationFrame]); 
//Return application frame. it it has the status bar hidden  then it will return 
bounds height -20 pixels.

Lets log the following results
NSLog(@"UIScreen bounds:  %@ UIScreen Application Frame : %@", bounds1,bounds2);

Output:
UIScreen bounds:  {{0, 0}, {320, 480}} UIScreen Application Frame : {{0, 20}, {320, 460}}

This features  can help us to avoid long lines of codings. 

Hope you enjoy it, for any questions ask me in the below section. 

 




















No comments:

Post a Comment

Followers