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

長按后調(diào)用 didSelectRowAtIndexPath

didSelectRowAtIndexPath called after long press(長按后調(diào)用 didSelectRowAtIndexPath)
本文介紹了長按后調(diào)用 didSelectRowAtIndexPath的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在 uitextfield 正下方有一個(gè) uitableview,它在 uitableview 單元格 中填充類似的字符串.項(xiàng)目被填充.然而 didSelectRowAtIndexPath 在長按后被調(diào)用

I have a uitableview right below a uitextfield that populates similar strings in a uitableview cell. The items get populated. However the didSelectRowAtIndexPath gets called after long press

我的 UITableView(嵌入在 UIScrollView 中)- didSelectRowAtIndexPath: 僅在長按自定義單元格后調(diào)用

My UITableView (is embedded in UIScrollView) - didSelectRowAtIndexPath: only being called after long press on custom cell

我的視圖層次結(jié)構(gòu):

  • UIScrollView(外滾動(dòng))
    • 其他一些視圖和按鈕
    • UItex 字段
    • UITableView(表格視圖)

    我的代碼

    class MyViewController:  BaseViewController , UITextFieldDelegate , UITableViewDelegate , UITableViewDataSource , UIGestureRecognizerDelegate  {
    
    
    
    @IBOutlet weak var autocompleteTableView: UITableView!
    var pastUrls = ["Men", "Women", "Cats", "Dogs", "Children","aaaaaaaaa","aaaaaaaaaaaaaaaaaaa","aaaaaaaaa","a","aa","aaa"]
    var autocompleteUrls = [String]()
    
    @IBOutlet weak var image_view_seacrh_ifsc: UIImageView!
    
    
    @IBOutlet weak var scrollView: UIScrollView!
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        // Do any additional setup after loading the view.
        self.scrollView.panGestureRecognizer.delaysTouchesBegan = true
    
        autocompleteTableView.delegate = self
        autocompleteTableView.dataSource = self
        autocompleteTableView.scrollEnabled = true
        autocompleteTableView.alwaysBounceVertical = false
        autocompleteTableView.allowsSelection = true
        autocompleteTableView.allowsSelectionDuringEditing = true
    
        autocompleteTableView.hidden = true
    
    
    
    
        super.hideKeyboard()
        super.showNavigationBarBackButton()
    
        let gesture_search_ifsc = UITapGestureRecognizer(target: self, action: "action_Search_Ifsc:")
        gesture_search_ifsc.delegate = self
        gesture_search_ifsc.numberOfTapsRequired = 1
    
        image_view_seacrh_ifsc.userInteractionEnabled = true
        image_view_seacrh_ifsc.addGestureRecognizer(gesture_search_ifsc)
    
    
    }
    
    
    
    
    func searchAutocompleteEntriesWithSubstring(substring: String)
    {
        autocompleteUrls.removeAll(keepCapacity: false)
    
        for curString in pastUrls
        {
            var myString:NSString! = curString as NSString
    
            var substringRange :NSRange! = myString.rangeOfString(substring)
    
            if (substringRange.location  == 0)
            {
                autocompleteUrls.append(curString)
            }
        }
    
        autocompleteTableView.reloadData()
        //autocompleteTableView.hidden = false
    }
    
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return autocompleteUrls.count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    
    
        let cell: AutoBankCell = tableView.dequeueReusableCellWithIdentifier("AutoBankCell") as! AutoBankCell
    
        cell.label.text = self.autocompleteUrls[indexPath.row]
        //cell.lbl.text = self.autocompleteUrls[indexPath.row]
    
        return cell
    
    
    }
    
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let selectedCell : UITableViewCell = tableView.cellForRowAtIndexPath(indexPath)!
        self.bank_name.text = self.autocompleteUrls[indexPath.row]
    
        self.autocompleteTableView.scrollEnabled = true
        self.autocompleteTableView.hidden = true
    }
    
    
    }
    

    我的 UItableView 被填充并在未嵌入 UIScrollView 時(shí)正常工作.

    My UItableView gets populated and works properly when not embedded in UIScrollView.

    推薦答案

    嘗試在 scroll view 中添加 uiview 并添加 uiview 比如你的 tableView,textfield,views and buttons 等等.

    Try to add uiview in your scroll view and add every elements in that uiview like your tableView,textfield,views and buttons etc.

    因此,該視圖用作容器視圖.

    So, that view works as container view.

    如果您使用 autolayout,請確保設(shè)置了適當(dāng)?shù)募s束.

    Make sure that you are setting proper constraints if you are using autolayout.

    第二件事是刪除不必要的手勢識(shí)別器隱式,這不是必需的.

    Second thing remove unnecessary gesture recognizer implicitly which is not required.

    默認(rèn)情況下,Tableview 啟用滾動(dòng),因此無需再次將其設(shè)置為 true.(順便說一句,這不會(huì)影響您的問題!!)

    Tableview have scroll enable by default so not need to set it true again. (it's not affect your issue btw!!)

    所以刪除不必要的配置并進(jìn)行適當(dāng)?shù)脑O(shè)置,我認(rèn)為您的問題將得到解決.

    So remove unnecessary configuration and make proper setup and your issue will be solved i think.

    這篇關(guān)于長按后調(diào)用 didSelectRowAtIndexPath的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中設(shè)置滾動(dòng)視圖內(nèi)容大小)
Stop a UITableView from automatically scrolling(阻止 UITableView 自動(dòng)滾動(dòng))
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 模擬器上運(yùn)行時(shí),使用 iOS 6.0 SDK 并為 iOS 5 Target 構(gòu)建會(huì)導(dǎo)致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創(chuàng)建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 久久久123| 亚洲夜射 | 久久久久久国产一区二区三区 | 精品一区久久 | 日韩视频中文字幕 | 久久三区| 日韩视频中文字幕 | 精品av久久久久电影 | www.嫩草 | 日韩精品一区二区三区久久 | 国产乱码精品一区二三赶尸艳谈 | 欧美激情综合色综合啪啪五月 | 韩国主播午夜大尺度福利 | 北条麻妃一区二区三区在线观看 | 国产玖玖| 狠狠干天天干 | 九九热在线观看 | 国产福利资源 | 在线成人免费视频 | 国产精品亚洲一区二区三区在线 | 久久久久中文字幕 | 成人自拍av | 国产黄色麻豆视频 | 亚洲欧美成人影院 | 一二三四在线视频观看社区 | 国产一级电影网 | 羞羞视频一区二区 | 久久久免费电影 | 黄a在线播放 | 成人在线亚洲 | 蜜臀久久99精品久久久久久宅男 | 国产精品欧美一区二区三区 | 精品久久国产视频 | 日韩精品在线免费 | 成人av在线播放 | 在线成人| 久久精品国产99国产精品 | 久久久国产精品网站 | 91精品国产综合久久香蕉麻豆 | 黄色片在线 | 欧美日韩精品免费观看 |