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

UitextField resignFirstResponder 在滾動視圖中不起作用

UitextField resignFirstResponder does not work in scroll view(UitextField resignFirstResponder 在滾動視圖中不起作用)
本文介紹了UitextField resignFirstResponder 在滾動視圖中不起作用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有 2 個函數可以 resignFirstResponder,但是當文本字段在滾動視圖中時它們都不起作用

I have 2 functions to resignFirstResponder but neither of them works when the textfields are in scrollview

我的功能:

-(BOOL)textFieldShouldReturn:(UITextField *)theTextField {

        if (theTextField == textField1) {
        [textField1 resignFirstResponder];
    }
    if (theTextField == textField2) {
        [textField2 resignFirstResponder];
    }
    if (theTextField == textField3) {
        [textField3 resignFirstResponder];
    }


    return YES;

}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [[event allTouches] anyObject];
    [textField1 resignFirstResponder];
    [textField2 resignFirstResponder];
    [textField3 resignFirstResponder];

}

我已經在 IB 中鏈接了滾動視圖,我不知道為什么只有當我在滾動視圖之外單擊時它才在那里不起作用.所以它只響應視圖,但是為什么?我認為 [[eventallTouches] anyObject] 響應 ANYObjects 處的 ALLtouches

I have linked the scroll view in IB, I can not find out why it does not works there only when I click outside of scrollview.so it only responds to view, but why?I thougth that [[event allTouches] anyObject] respond to ALLtouches at ANYObjects

感謝您的幫助

推薦答案

增加一個透明的視圖,繼承 UIControl 的大小等于你的滾動視圖,不是更優雅一點嗎到它的最后面,然后為這個新視圖創建 IBAction?

Wouldn't it be a bit more elegant to add a transparent view that inherits UIControl with the size that equal to your scroll view to the very back of it and then just create IBAction for this new view?

這篇關于UitextField resignFirstResponder 在滾動視圖中不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中設置滾動視圖內容大小)
Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構建會導致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 婷婷久久综合 | 色接久久 | 中文字幕在线观看一区 | 99久久成人| 日韩视频国产 | 亚洲欧美综合精品久久成人 | 天天做日日做 | 欧美日韩免费一区二区三区 | 久久精品一级 | 亚洲一区中文字幕在线观看 | 亚洲日本欧美日韩高观看 | 亚洲精品综合 | 国产a一区二区 | 99热这里 | 成人av一区二区在线观看 | 亚洲一区二区三区视频免费观看 | 波多野结衣中文字幕一区二区三区 | 日日爱视频 | 91久久精品国产91久久 | 久久一区二区三区免费 | 日韩免费网站 | 欧美日韩免费视频 | 久久尤物免费一区二区三区 | 日韩av在线一区二区 | 中文字幕二区三区 | 一区二区免费 | 免费观看毛片 | 天天噜天天干 | 国内精品久久久久久久 | 亚洲综合色视频在线观看 | 成人免费大片黄在线播放 | 亚洲精品电影在线观看 | 蜜桃在线视频 | 欧美精品免费观看二区 | 欧美日韩视频在线 | 中文字幕成人免费视频 | 欧美视频三区 | 91欧美激情一区二区三区成人 | 国产色网 | 黄色一级大片在线免费看产 | 国产精品久久久久久久7电影 |