久久久久久久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 可縮放?)
主站蜘蛛池模板: 欧美精品国产 | 亚洲免费二区 | 欧美成人精品欧美一级乱黄 | 免费观看全黄做爰大片视频美国 | 永久免费精品视频 | 免费国产精品视频 | 四虎久久| 成人免费av | 涩涩在线| 亚洲永久免费 | 国产福利在线 | 久久久精品在线观看 | 一区二区三区四区精品 | 好色影院| 欧美日韩免费视频 | 超碰一区二区 | 91在线网站| 黄色性视频 | 久久99精品国产麻豆91樱花 | 国产一级片在线播放 | 日韩欧美中文字幕在线观看 | 综合在线视频 | 一区二区三区在线播放 | 欧美成人精品一区 | 成人免费黄色大片 | 日本免费不卡视频 | 亚洲理论片 | 国产精品999999| 国产成人在线播放 | 亚洲视频一区二区三区 | 免费看黄色小视频 | 一区二区三区网站 | 日韩久久久久久久 | 日本毛片视频 | 国产视频在线观看视频 | 日韩免费高清视频 | 三级av网站| 日韩成人影院 | 在线不卡一区 | 欧美一级久久 | 永久免费看mv网站入口亚洲 |