UISearchBar

Forum for posting sample code and examples, new posts creation is not allowed, but everybody can comment

UISearchBar

Postby sunny » Mon Sep 21, 2009 1:50 pm

kunicki has posted UISearchBar example of obj-c/js mix
P.S. I modified it a little bit to dismiss keyboard when search button pressed
Attachments
uisearchbar.zip
updated to 1.6.2+
(39.84 KiB) Downloaded 205 times
Screen shot 2009-09-21 at 14.50.25.png
Screen shot 2009-09-21 at 14.50.25.png (195.93 KiB) Viewed 2143 times
User avatar
sunny
Staff
 
Posts: 1786
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

Re: UISearchBar

Postby d0csp33d » Fri Sep 25, 2009 6:22 pm

All I see is a white page that says "content here"
User avatar
d0csp33d
 
Posts: 175
Joined: Mon Jul 13, 2009 2:23 pm

Re: UISearchBar

Postby Mografi » Sat Sep 26, 2009 10:42 pm

im not good with the objective-c at all (hence using nimblekit)....how would i change the color of the uisearchbar (the rest of my gui is black, and id like to match it up)?

Nevermind, I got it! very easy, added this in the showsearchbar part (where its setup):

_searchBar.tintColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
Last edited by Mografi on Sat Sep 26, 2009 10:47 pm, edited 1 time in total.
Mografi
 
Posts: 49
Joined: Wed Jun 10, 2009 3:01 am

Re: UISearchBar

Postby sunny » Sat Sep 26, 2009 10:46 pm

insert
Code: Select all
_searchBar.barStyle = UIBarStyleBlack;

before
Code: Select all
[_webView addSubview:_searchBar];
User avatar
sunny
Staff
 
Posts: 1786
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

Re: UISearchBar

Postby Mografi » Sat Sep 26, 2009 10:48 pm

thats good too! hah, I guess the tint way can make it any color though, thanks!
Mografi
 
Posts: 49
Joined: Wed Jun 10, 2009 3:01 am

Re: UISearchBar

Postby kunicki » Sun Sep 27, 2009 11:39 am

Side Note:

I also am using the following snippet with this example to make the searchbar have focus. I need this because my tool is a dictionary and the user wants to start using ASAP.

Code: Select all
- (void)focusSearchBar
{
   [_searchBar becomeFirstResponder];
}
kunicki
 
Posts: 58
Joined: Mon Sep 07, 2009 10:49 am

Re: UISearchBar

Postby tuneez » Thu Oct 08, 2009 12:35 pm

Hi,
I'm using your search, but I've got a problem. If I go to my page search, go back to the last page, and then go again to my search page, it freezes for 10 seconds, and search bar is not shown. Here's the code I set in head part :

NKRegisterClass("MyUISearchBar");
CallNKitAction("showSearchBar?className=MyUISearchBar");

var rech = "";

function searchUpdated(searchValue) {
rech = searchValue;
}
function searchButtonClicked()
{
CallNKitAction("dismissKeyboard?className=MyUISearchBar");
if (rech.length>1) {
.........
}
}


What could be the problem ? Do I have to dealloc it ?
tuneez
 
Posts: 52
Joined: Thu Jun 04, 2009 12:10 pm
Location: Lyon, FRANCE

Re: UISearchBar

Postby sunny » Thu Oct 08, 2009 5:34 pm

I'm not sure if it will fix your problem, but every time showSearchBar is called it is recreated and placed over old one, so try inserting code
Code: Select all
if (_searchBar !=nil) return;
as a first line in - (void)showSearchBar method
User avatar
sunny
Staff
 
Posts: 1786
Joined: Sat May 30, 2009 5:18 am
Location: kiev, Ukraine

Re: UISearchBar

Postby tuneez » Fri Oct 09, 2009 7:20 pm

No.... It doesn't work....
tuneez
 
Posts: 52
Joined: Thu Jun 04, 2009 12:10 pm
Location: Lyon, FRANCE

Re: UISearchBar

Postby tomtom » Tue Oct 13, 2009 10:27 pm

Hi,

Ok for the keyboard,
but how can I dissmiss the search bar?
:roll:

Thanks for your help
tomtom
 
Posts: 6
Joined: Wed Sep 02, 2009 4:54 pm

Next

Return to Sample Code

Who is online

Users browsing this forum: No registered users and 1 guest