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

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

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

問題描述

我有 2 個函數(shù)可以 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];

}

我已經(jīng)在 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 的大小等于你的滾動視圖,不是更優(yōu)雅一點嗎到它的最后面,然后為這個新視圖創(chuàng)建 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模板網(wǎng)!

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

相關文檔推薦

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(以編程方式創(chuàng)建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 成年人在线视频 | 91精品久久久 | 欧洲尺码日本国产精品 | 亚洲成人网在线观看 | 国产精品一区二区欧美黑人喷潮水 | 午夜久久久 | 免费看91 | 欧美久久久 | 国产日产精品一区二区三区四区 | 久久久久网站 | 国产高潮好爽受不了了夜夜做 | 国产三级精品三级在线观看四季网 | 欧美精品国产精品 | 日本精品一区 | 欧美一级在线 | 午夜亚洲 | 国产精品日韩 | 四虎最新 | 中文字幕动漫成人 | 欧美激情综合 | 久久久综合久久 | 日韩在线免费 | 国产91九色 | 真人一级毛片 | 中文字幕国产一区 | 久久亚洲一区 | 国产在线高清 | 天堂一区在线观看 | 亚洲精品黄色 | 毛片黄片| 精品国产99| 国产在线观看一区二区三区 | 欧美一级免费看 | 久久精品国产99国产 | 在线观看日本网站 | 国产精品久久久久久一区二区三区 | 91精品国产91久久综合桃花 | 国产亚洲一区二区三区在线观看 | 一级无毛片 | 国产精品成人在线观看 | 一区二区三区影院 |