37

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?

David542
  • 101,766
  • 154
  • 423
  • 727

1 Answers1

126

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
Hussain Shabbir
  • 14,343
  • 5
  • 36
  • 54