Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App (iOS7) Understanding Views and View Controllers CGRect and Frame

Andres Kwan Orjuela
Andres Kwan Orjuela
1,653 Points

challenge 1 UIButton doesn't have a "frame" property, so why ...

UIButton doesn't have a "frame" property, so why is valid this "self.showQuote.frame = CGRect(100,250,280,44)

2 Answers

Hi Andres, if you go to xcode then if you select a button then go to the utilities pane and then click on the size inspector, you will find a frame layout, which i guess does represents the frame property of a button. Frame property just shows where a button will be placed (ie the x and y coordinates) in the view and what will be the size( ie the width and height) of the button.

So, self.showQuote.frame=CGRectMake(100,250,280,44); is a valid statement and does work.

Andres Kwan Orjuela
Andres Kwan Orjuela
1,653 Points

Thanks. Now I understand UIButton inherits from UIView, which has a frame attribute. BTW I have to uncheck Autolayout in order to see the modifications of the button with CGRect