开发者

How do I use UISearchBar to search the web?

开发者 https://www.devze.com 2023-02-23 05:23 出处:网络
I want to use 开发者_如何转开发the UISearchBar and used its text which further can be put into a url and that url will search the web. I am unable to dismiss the keyboard. I have tried using the first

I want to use 开发者_如何转开发the UISearchBar and used its text which further can be put into a url and that url will search the web. I am unable to dismiss the keyboard. I have tried using the first responder thng but that doesn't seems to work. I am new to iPhone development and fairly new to programming world so please bear with me. any help would be appritiated.


Add a search bar delegate to yourclass.h as following:

@interface yourclass : yourviewcontroller < UISearchBarDelegate >

Then, implement this function of the delegate into yourclass.m:

(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
   [searchBar resignFirstResponder];
   //your code
}
0

精彩评论

暂无评论...
验证码 换一张
取 消