Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to NSLog a CGRect [duplicate]

Tags:

objective-c

I am trying to see some properties of a CGRect and doing:

NSLog(@"%@", frame); 

However, I get an error that says CGRect is not an id type. How would I print the frame to see attributes of it?

like image 806
David542 Avatar asked Oct 04 '14 17:10

David542


1 Answers

You need to use NSStringFromCGRect which will convert the CG structs into NSString, Refer below:-

NSLog(@"%@", NSStringFromCGRect(frame)); 

Also below are the following other functions which can be used for NSLog CG Structs as well:-

NSStringFromCGPoint   NSStringFromCGSize   NSStringFromCGRect   NSStringFromCGAffineTransform   NSStringFromUIEdgeInsets 
like image 104
Hussain Shabbir Avatar answered Sep 28 '22 08:09

Hussain Shabbir