38

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
  • 104,438
  • 178
  • 489
  • 842

1 Answers1

130

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,801
  • 5
  • 40
  • 56