ios – 如何通过Swift找到UITextField的位置?

ios – 如何通过Swift找到UITextField的位置?,第1张

概述如何通过 Swift找到UITextField的位置? 我想知道我的UITextField和底部视图之间的距离. 谢谢! 试试这个, 在程序中获取文本位置. println("Your textfiled position : \(textfiled.frame)") // (x,y,width,height) 在程序中获取BottowView位置. println("BottomView pos 如何通过 Swift找到UITextFIEld的位置?

我想知道我的UITextFIEld和底部视图之间的距离.

谢谢!

解决方法 试试这个,

在程序中获取文本位置.

println("Your textfiled position : \(textfiled.frame)") // (x,y,wIDth,height)

在程序中获取BottowVIEw位置.

println("BottomVIEw position : \(bottomvIEw.frame)") // (x,height)

获得两个位置之间的距离.

println("distance x:(textfiled.frame.origin.x - bottomvIEw.frame.origin.x) ")println("distance y:(textfiled.frame.origin.y - bottomvIEw.frame.origin.y) ")println("distance wIDth:(textfiled.frame.size.wIDth - bottomvIEw.frame.size.wIDth) ")println("distance height:(textfiled.frame.size.height - bottomvIEw.frame.size.height) ")
总结

以上是内存溢出为你收集整理的ios – 如何通过Swift找到UITextField的位置?全部内容,希望文章能够帮你解决ios – 如何通过Swift找到UITextField的位置?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1009499.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存