久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 UITableViewCell 內編輯 UITextField 時禁用 UITableVi

Disabling automatic scrolling of UITableView when editing UITextField inside UITableViewCell(在 UITableViewCell 內編輯 UITextField 時禁用 UITableView 的自動滾動)
本文介紹了在 UITableViewCell 內編輯 UITextField 時禁用 UITableView 的自動滾動的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 UITableView 中使用自定義 UITableViewCell.這些 UITableViewCell 中的每一個都非常高,并且在頂部包含一個 UITextField.

I'm using custom UITableViewCells inside my UITableView. Each of these UITableViewCells is pretty high and contains a UITextField at the top.

當用戶點擊 UITextField 以對其進行編輯時,會出現一個鍵盤,并且 UITableView 會自動滾動,以使單元格位于屏幕頂部.

When a user taps the UITextField in order to edit it, a keyboard appears and the UITableView scrolls automatically so that the cell is at the top of the screen.

問題在于,這會將 UITableView 滾動到 UITableViewCell 的底部,而不是頂部.當 UITableViewCell 為高且已編輯時,UITextField 位于頂部,因此您看不到 UITextField.我知道如何以編程方式滾動 UITableView,但我只是不知道如何禁用這種自動滾動,以便我可以自己滾動 UITableView.我該怎么做?

The problem is that this scrolls the UITableView to the bottom of the UITableViewCell, not the top. When the UITableViewCell is high and edited the UITextField is at the top so you can't see the UITextField. I know how to scroll the UITableView programmatically, but I just don't know how to disable this automatic scrolling so that I can scroll the UITableView on my own. How can I do this?

推薦答案

自動滾動行為位于 UITableViewController 功能中.

The autoscroll-behavior is located in the UITableViewController functionality.

要禁用自動滾動,我找到了兩種方法:

To disable the automatic scrolling I found two ways:

  1. 使用 UITableViewController 代替 UIViewController - 自行設置數據源和委托.
  2. 重寫viewWillAppear方法,不調用[super viewWillAppear: animated]
  1. Use instead of the UITableViewController simply a UIViewController - set the datasource and delegate on your own.
  2. Override the viewWillAppear method and don't call [super viewWillAppear: animated]

使用這兩種解決方案,您不僅禁用了自動滾動,還禁用了其他一些不錯但不是必不可少的功能,這些功能在 Apple 的類參考概述中進行了描述:

With both solution you disable not only the Autoscroll, but also some other nice but not essential features, that are described in the overview of Apple′s class reference:

https://developer.apple.com/documentation/uikit/uitableviewcontroller

這篇關于在 UITableViewCell 內編輯 UITextField 時禁用 UITableView 的自動滾動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to subclass UIScrollView and make the delegate property private(如何繼承 UIScrollView 并使委托屬性私有)
Swift - how to get last taken 3 photos from photo library?(Swift - 如何從照片庫中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設置 contentOffset 觸發 scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動時暫停 NSTimer)
主站蜘蛛池模板: 午夜视频精品 | 亚洲精品不卡 | 99综合网 | 91看片视频| 韩日在线观看视频 | 一区二区三区国产视频 | 伊人精品在线 | 精品日韩一区二区三区 | 国产视频中文字幕 | 亚洲国产视频一区 | 大陆一级毛片免费视频观看 | 日本免费视频在线观看 | 日韩成人av在线播放 | 一区二区三区免费观看 | 美日韩免费 | 国产精品久久久久久久7电影 | 亚洲夜夜爽 | 日韩综合在线 | 男女网站免费 | 国产成人在线免费 | 这里只有精品99re | 亚洲欧美国产毛片在线 | 精品视频一区二区 | 欧美电影在线 | 99久久精品一区二区毛片吞精 | 黄色成人av | 久久综合成人精品亚洲另类欧美 | 一区二区不卡 | 91丨国产 | 国产精品日韩高清伦字幕搜索 | 免费久久精品 | 中文成人在线 | 亚洲午夜av| 人人性人人性碰国产 | 三级国产三级在线 | 成人综合伊人 | 国产精品99久久久久久www | 久久97精品| 二区三区视频 | 精品在线一区 | av毛片|