---
title: "How to print CGRect value using NSLog?"  
description: "How to print CGRect value using NSLog?"  
author: "Anonymous User"  
published: 2016-01-18  
updated: 2016-01-18  
canonical: https://www.mindstick.com/forum/33891/how-to-print-cgrect-value-using-nslog  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to print CGRect value using NSLog?

I want to know how can I [print](https://www.mindstick.com/blog/301752/types-of-3d-printing-technology) CGRect [attributes](https://www.mindstick.com/articles/13105/2-attributes-that-make-your-odoo-ecommerce-theme-productive-and-engaging)([frame](https://www.mindstick.com/articles/749/html-frames)) [values](https://www.mindstick.com/forum/327/sum-textbox-values) on [console](https://www.mindstick.com/blog/210/the-console-class) using NSLog() method.\
I tried to see [properties](https://www.mindstick.com/articles/23331/nootropics-7-different-types-and-their-unique-properties) of CGRect, like this:

```
NSLog(@"CGRect Value: %@", rect);
```

But, I got [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) which will says CGRect is not an id type. So, how can I print the frame of CGRect for getting attributes.

## Replies

### Reply by Tarun Kumar

Yes, we can't print CGRect attributes directly in NSLog.\
for that, cocoa provides us a method NSStringFromCGRect, because it will convert the CG structs into nsstring- below we are provided an example:

```
NSLog(@"CGRect Value: %@", NSStringFromCGRect(rect));
```

I'm providing some other functions which can help you to print CG struct values:\
1. NSStringFromCGRect\
2. NSStringFromCGSize\
3. NSStringFromCGPoint\
4. NSStringFromUIEdgeInsets\
5. NSStringFromCGAffineTransform


---

Original Source: https://www.mindstick.com/forum/33891/how-to-print-cgrect-value-using-nslog

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
