The bound bounds property of a UIView does not affect its contents

I'm new to programming on the iPhone, and I'm trying to understand how the frame and bounds properties work. In the interface UIView , I created a UIView where I put the UIImageView as a child. I made UIImageView bigger than the parent. and set the “subtitle” property to true for the parent UIView and false for the child UIImageView.
When I change the frame.origin property of the child UIImageView programmatically. but when I change the bounds.origin property of the parent UIView , I see nothing. I probably misunderstand the purpose of bounds .

What I need to do to learn about the behavior described in the iPhone Application Programming Guide:

You can change the start of borders without changing two other properties. When you do this, the view displays part of the main image that you have identified. InFigure2-4 (p. 56), the original origin is set to (0,0,0,0). In Figure 2-5, this beginning moves to (8.0, 24.0). As a result, another part of the base image is displayed. However, since the rectangle of the frame has not changed, the new content is displayed in the same place in the parent view as before.

Thanks in advance. Andrew

+6
iphone
source share
1 answer

First of all, make sure that you have the correct link to the image before trying to change its borders. Make sure it is not nil .

Secondly, you may need to change the rectangle and then set it again in a separate statement, for example:

 CGRect rect = imageView.bounds; rect.origin = CGPointMake(whatever, whatever); imageView.bounds = rect; 

Grades may not even be what you want. I don’t know where you got this quote, but it doesn’t sound like that. Try using the image view frame to place it in your supervisor.

0
source share

All Articles