English 中文(简体)
在iOS上,改变UIView对象框架和中心能够改变内部协调系统吗?
原标题:On iOS, can changing a UIView object s frame and center alter its internal coordinate system?

在iOS上,如果我们改变查看 s frame ,我们就会改变其 bunds ,如果我们改变其 bunds ,我们就会改变其 frame

但是我们可以改变内部协调系统,

CGRect b = v.bounds;    // v is the UIView object
b.origin.x = 10000;
b.origin.y = 10000;
v.bounds = b;

现在, 视图的左上角是 < code> (1000, 10000, 10000) 的坐标 。 仅通过更改 < code > frame 和 < code> center , 但不使用 < code > bunders , 是否也可以做到这一点?

最佳回答

在iOS上,如果我们改变观点框架, 我们改变其界限, 如果我们改变其界限, 我们改变其框架。

s 一半正确。 只有这两个直肠的大小 < / i > 被捆绑在一起。 从文档中可以:

边框和边框矩形的大小部分是结合在一起的,以便改变两个矩形的大小,使两个矩形的大小都更新。

您的示例将修改内部协调系统的来源, 而不改变其在超级视图协调系统中的位置。 您无法通过 < code> frame 或 < code> center 属性实现该行为; 它们只会影响其超级视图协调系统中的视图位置 。

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签