Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-16-2008, 09:29 PM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 53
Default uisearchbar anyway to set cancel , search button text?

UISearchBar...

have an iboutlet.. want to replace the Cancel button's text with something else
and the search button on the keyboard with other text..

tia
turinreza is offline   Reply With Quote
Old 06-19-2008, 05:03 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 71
Default Re: uisearchbar anyway to set cancel , search button text?

I am looking for a way to set the text of the Search button on the keyboard when using a UISearchBar. Unfortunately UISearchBar doesn't have a returnKeyType property like UITextField does.
halusha is offline   Reply With Quote
Old 06-19-2008, 05:12 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 71
Default Re: uisearchbar anyway to set cancel , search button text?

I just filed an enhancement request (assigned Problem ID: 6022261) for UISearchBar to adopt the UITextInputTraits protocol. According to the UITextInputTraits documentation: "All objects that support keyboard input must adopt this protocol." This would let me set the return key type.

I don't think that would help you with the Cancel button text though.
halusha is offline   Reply With Quote
Old 08-12-2008, 05:26 PM   #4 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 1
Default

Here's a solution:
Do not use the cancel button with UISearchBar
Add a button on the navigation bar to do job.
This is what Apple does in their Addresses.app
rakuraku is offline   Reply With Quote
Old 09-21-2008, 10:43 AM   #5 (permalink)
Registered Member
 
Jume's Avatar
 
Join Date: Jul 2008
Location: Slovenia, EU
Posts: 264
Send a message via Skype™ to Jume
Default

Quote:
Originally Posted by rakuraku View Post
Here's a solution:
Do not use the cancel button with UISearchBar
Add a button on the navigation bar to do job.
This is what Apple does in their Addresses.app
I'm doing it like this. Any idea on how to make the UISearchBar keyboard go away when my custom cancel button is clicked?

Thx,
Jume
Jume is offline   Reply With Quote
Old 09-21-2008, 12:33 PM   #6 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 1,431
Default

Code:
	[searchBar resignFirstResponder];
PhoneyDeveloper is offline   Reply With Quote
Old 09-21-2008, 01:45 PM   #7 (permalink)
Registered Member
 
Jume's Avatar
 
Join Date: Jul 2008
Location: Slovenia, EU
Posts: 264
Send a message via Skype™ to Jume
Default

Quote:
Originally Posted by PhoneyDeveloper View Post
Code:
	[searchBar resignFirstResponder];
I tried this but doesn't work
Jume is offline   Reply With Quote
Old 01-13-2010, 09:17 AM   #8 (permalink)
Registered Member
 
sophisti's Avatar
 
Join Date: Nov 2009
Location: Amsterdam
Posts: 5
Default

Quote:
Originally Posted by rakuraku View Post
Here's a solution:
Do not use the cancel button with UISearchBar
Add a button on the navigation bar to do job.
This is what Apple does in their Addresses.app
This is how you show the cancel button btw:

searchBar.showsCancelButton = YES;
sophisti is offline   Reply With Quote
Old 03-24-2011, 06:33 PM   #9 (permalink)
What?
 
Join Date: Nov 2010
Posts: 5
Default

A good way to dismiss the keyboard regardless of the context is to call this method:

Code:
[self.view endEditing:YES];
I often create a quick void method in my view controllers which calls this code, and then I can easily dismiss the keyboard whenever I need to. (The "YES" being passed into the method is a boolean for whether or not the method should "force quit" whatever editing mode it tries to close if it is met with resistance.)

Last edited by Poatface; 03-24-2011 at 06:35 PM.
Poatface is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outline text in a UILabel? Groucho iPhone SDK Development 3 11-03-2008 10:33 PM
web page search nownot iPhone SDK Development 0 07-04-2008 01:30 PM
Adding button and text field in uitableviewcell sasikantpradeep iPhone SDK Development 1 06-06-2008 08:55 AM
Help with Text Orientation Nitrex88 iPhone SDK Development 2 04-28-2008 03:06 PM
Text File opening ayrkain iPhone SDK Development 3 04-22-2008 04:59 PM


» Advertisements
» Online Users: 238
12 members and 226 guests
ADY, AragornSG, CKAmike, Dani77, Duncan C, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0