久久久久久久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)
主站蜘蛛池模板: 亚洲 欧美 日韩在线 | 久久精品这里精品 | 欧美日韩在线综合 | 久久精品一区二区三区四区 | 久久精品欧美一区二区三区不卡 | 久草网免费 | 91精品久久久 | 亚洲一区二区三区桃乃木香奈 | 男女羞羞视频网站 | 精品视频在线观看 | 亚洲精品在线看 | 91精品国产综合久久香蕉922 | 激情自拍偷拍 | 亚洲三区在线观看 | 成人久久久 | 7777在线视频 | 国产黄色大片网站 | 国产精品国产精品 | 91精品国产欧美一区二区 | 国产欧美日韩精品一区 | 欧美日韩在线一区二区 | 成人免费福利视频 | 午夜一级大片 | 中文字幕av色 | 毛片网在线观看 | 羞羞视频网页 | 91婷婷韩国欧美一区二区 | 亚洲综合首页 | 91精品国产综合久久精品 | 中文字幕在线看 | 国产清纯白嫩初高生在线播放视频 | 激情久久网| 亚洲av毛片 | 99精品一区二区 | 久久精品国内 | 国产在线高清 | 欧美激情 一区 | 天天射网站 | 羞羞的视频免费看 | 成人一区二区视频 | 91视视频在线观看入口直接观看 |