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

在 UITableViewCell 內(nèi)編輯 UITextField 時禁用 UITableVi

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

問題描述

我在 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.

當(dāng)用戶點(diǎn)擊 UITextField 以對其進(jìn)行編輯時,會出現(xiàn)一個鍵盤,并且 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 的底部,而不是頂部.當(dāng) 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 - 自行設(shè)置數(shù)據(jù)源和委托.
  2. 重寫viewWillAppear方法,不調(diào)用[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 的類參考概述中進(jìn)行了描述:

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

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

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

相關(guān)文檔推薦

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(以編程方式設(shè)置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應(yīng)用程序式間隙)
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)
主站蜘蛛池模板: 中文字幕欧美一区 | 日日夜夜精品免费视频 | 久久av网站 | 天天插天天操 | 免费看黄视频网站 | 99综合网 | 四虎影院久久 | a爱视频| 91av视频在线 | 日韩福利在线 | 国产一区二区三区视频 | 91视频一88av | 丁香综合| 亚洲日本成人 | 国产精品美女久久久久久不卡 | 国产高潮好爽受不了了夜色 | 午夜专区| 成人福利在线视频 | 一级a性色生活片久久毛片波多野 | 久久大 | 精品国产乱码久久久久久牛牛 | 国产精品久久久亚洲 | 国产精品欧美一区喷水 | 91精品国产91久久久久久吃药 | 日韩成人在线观看 | 黄色精品视频网站 | 美美女高清毛片视频免费观看 | 一区二区三区四区电影视频在线观看 | aⅴ色国产 欧美 | 成年免费大片黄在线观看岛国 | 日韩一级免费电影 | 狠狠入ady亚洲精品经典电影 | 亚洲国产精品视频 | 91视频一88av| 精品国产欧美一区二区 | 欧美九九| 色综合99 | 国产精品区二区三区日本 | caoporn国产精品免费公开 | 伊人网在线看 | 夜夜草 |