子View的位置是如何设置的?

发布于 2024-09-10 02:08:11 字数 201 浏览 4 评论 0原文

我正在使用标准的 facebook 连接按钮和方法

FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];
[self.view addSubview: loginButton];

,它把它放在我不想要的地方。如何设置子视图位置?

I am using the standard facebook connect button with the method

FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];
[self.view addSubview: loginButton];

and It places it where I dont want it. How can I set that subviews location?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小糖芽 2024-09-17 02:08:11

访问视图的 frame 属性:

loginButton.frame = CGRectMake(originX, originY, sizeWidth, sizeHeight);

Access the view's frame property:

loginButton.frame = CGRectMake(originX, originY, sizeWidth, sizeHeight);
李不 2024-09-17 02:08:11

您可以使用 setFrameOrigin: 来设置视图相对于其父视图的原点:

NSPoint origin = NSMakePoint(0,0);
FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];
[loginButton setFrameOrigin:origin];
[self.view addSubview: loginButton];

You set a view's origin relative to their parent view using setFrameOrigin:

NSPoint origin = NSMakePoint(0,0);
FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];
[loginButton setFrameOrigin:origin];
[self.view addSubview: loginButton];
烟雨凡馨 2024-09-17 02:08:11

与其他 UIView 一样,您可以使用其框架属性来指定其大小和位置。

您还可以使用 center 属性来重新定位控件。

Like every other UIView, you can use its frame property to specify its size and position.

You can also use the center property to just reposition the control.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文