iOS SDK:通过代码将按钮移动到屏幕中心

前端之家收集整理的这篇文章主要介绍了iOS SDK:通过代码将按钮移动到屏幕中心前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想通过代码将按钮移动到屏幕的中心.我看到某处只是几行代码,但找不到它们.

解决方法

这应该做到:
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);
原文链接:https://www.f2er.com/iOS/329362.html

猜你在找的iOS相关文章