iOS版SDK:移动按钮到屏幕由code中心 [英] iOS SDK: Moving the button into the center of screen by code

查看:162
本文介绍了iOS版SDK:移动按钮到屏幕由code中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想搬到一个按钮,屏幕由code的中心。我看到的地方,这只是code的几行,却找不到他们。

I want to move a button to the center of the screen by code. I saw somewhere it is just few lines of code, but could not find them.

推荐答案

这应该这样做:

yourButton.frame = CGRectMake(self.view.frame.size.width/2 - yourButton.frame.size.width/2, self.view.frame.size.height/2 - yourButton.frame.size.height/2, yourButton.frame.size.width, yourButton.frame.size.height);

这篇关于iOS版SDK:移动按钮到屏幕由code中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆