[英]Confused about plotting origin in iOS
码
self.view.frame.origin.y = self.view.frame.origin.y - keyboardSize.height
在这里,我试图将视图原点设置为键盘的视图高度
我的输出
我的怀疑
根据数学,我的视图必须放在键盘下方,这是怎么回事?
UIView的坐标空间与您在数学类中学习的笛卡尔坐标平面不完全相同,可能看起来像这样:
UIView
在UIKit中,正y方向是向下的,而负y方向是向上的。 这意味着y坐标小的视图将位于其父视图的顶部。 当您增加其y坐标时,它会向下移动。 看起来像这样:
这行代码:
self.view.frame.origin.y=self.view.frame.origin.y-keyboardSize.height
减小self.view的y坐标,从而将其向上移动。 减多少 好吧,键盘的高度。
self.view
视图坐标系从顶部(0)到底部(设备高度)递增,因此
降低视图的y原点位置会升高视图
[英]Confused about iOS notifications
[英]Phonegap - confused about Android and IOS
[英]Confused about the direction of iOS constraints
[英]ios confused about strong/weak references
[英]Very confused about hello world application in iOS
[英]iOS: confused about using the AppDelegate properly
[英]Confused about ios image size on different iphone
[英]I’m confused about “anonymous iOS memory”
[英]iOS Core Data: Confused about Core Data and database
[英]iOS - Confused about when to use Core Data in my app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.