gpt4 book ai didi

iOS SDK : Moving the button into the center of screen by code

转载 作者:技术小花猫 更新时间:2023-10-29 11:09:37 25 4
gpt4 key购买 nike

我想通过代码将一个按钮移动到屏幕中央。我在某处看到它只有几行代码,但找不到它们。

最佳答案

这使按钮在其父 View 中居中:

CGRect bounds = button.superview.bounds;
button.center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));

关于iOS SDK : Moving the button into the center of screen by code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11527824/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com