views:

308

answers:

3
A: 

if just want to increase the size of NSSearchfield then u did not need to subclass it you just define NSSearchfield programetically and give ur desire size during defining of frame.

example is given below

mySearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0,44,320,70)]; mySearchBar.autocorrectionType = UITextAutocorrectionTypeNo; mySearchBar.autocapitalizationType = UITextAutocapitalizationTypeNone; mySearchBar.showsCancelButton = NO; mySearchBar.delegate=self; [self.view addSubview:mySearchBar];

or if you want some diffrent look specify it i may help you

Nirmit Patel
I want it to have a emboss and I want it to have less of a shadow, look at the picture to see what I mean.
Joshua
+1  A: 

You need to make a custom NSSearchFieldCell subclass, and override drawWithFrame:, then set your NSSearchField to use that cell. You can either draw your custom border in code, or use end-cap images and a background image for the center that you tile horizontally.

Here's an example of old code that used the latter approach to make a custom NSTextField that looked like a search field back before NSSearchField was a standard control.

smorgan
Ah, I see. How would I draw a custom border with code?
Joshua
See the Cocoa Drawing Guide: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/
Peter Hosey
What code would I need to give it that emboss look and remove the shadow?
Joshua
I also noticed that the Search Field in Firefox looks like this, is there some source code for Firefox which includes this?
Joshua
Firefox doesn't use native OS controls, so its code would probably not be useful to you. As for how to draw it, try reading the "Paths" section from the link that Peter gave you. If you are having trouble using specific drawing routines, try asking new SO questions showing what you are trying and what's non working, rather than asking for people to do all the work for you up-front.
smorgan
A: 

Honestly, that field on the left just looks double-struck to me. So you might try just overriding drawRect: to send [super drawRect:] twice. ☺

(The real test would be if you could show both fields with text in them. Double-struck text is really easy to spot, and is definitely not something you want.)

Peter Hosey
What code would I need to give it that emboss look and remove the shadow?I also noticed that the Search Field in Firefox looks like this, is there some source code for Firefox which includes this?
Joshua