[英]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.