开发者

How do I position a subview within a principal view?

开发者 https://www.devze.com 2023-02-22 07:19 出处:网络
I created a class in my project and th开发者_运维技巧is class is a subclass of another class; I want place this subview in the principal view, I reduced x and y to make it smaller, but it always appea

I created a class in my project and th开发者_运维技巧is class is a subclass of another class; I want place this subview in the principal view, I reduced x and y to make it smaller, but it always appears at the top left, how can I set it in other position?


Would be easier to answer if you posted some code. Most likely, you need to modify the frame property of your view. frame is a rectangle (CGRect) that determines the position and size of your view in the coordinate system of its superview. The bounds property is similar but expresses origin and size in the coord system of itself (e.g. origin is 0,0).

For other layout tips, look at the autoresizingMask and contentMode properties of views. In fact, read up on views in general. The Apple docs are good and lots of stuff here about them.

0

精彩评论

暂无评论...
验证码 换一张
取 消