由于某种原因,搜索栏没有调用 textDidChange [英] Search bar not calling textDidChange for some reason

查看:26
本文介绍了由于某种原因,搜索栏没有调用 textDidChange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Xcode 很陌生,所以请原谅我的无知.

我在 ViewController 上有一个 searchBar 和一个 tableView.我有一个用于 searchBarIBOutlet,我在 viewDidLoad 中指定了 searchBar.delegate = self.由于某种原因 textDidChange 在我在搜索栏中输入时没有被调用.

谁能帮我解决这个问题?谢谢.

解决方案

我搞定了.尽管我在 viewDidLoad 中指定了 searchBar.delegate = self,但直到我在故事板界面中指定了 searchBar 委托后,它才起作用.>

I'm very new to Xcode so please excuse my ignorance.

I have a searchBar and a tableView on a ViewController. I have an IBOutlet for the searchBar and I specified searchBar.delegate = self in viewDidLoad. For some reason textDidChange is not getting called when I type in the search bar.

Can anyone help me with this? Thank you.

解决方案

I got it working. Even though I specified searchBar.delegate = self in viewDidLoad, it did not work until I specified the searchBar delegate in the storyboard interface.

这篇关于由于某种原因,搜索栏没有调用 textDidChange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆