David Ben Ari
David Ben Ari

Reputation: 2309

UISearchBar background appearance

I want my search bar to look like this:

enter image description here

this is how i created the search bar:

    search = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 308, 27)];
    search.delegate = self;
    search.center = CGPointMake(self.frame.size.width/2, 10 +search.frameHeight/2);
    search.placeholder = NSLocalizedString(@"search foods you like or dislike", nil);
    search.backgroundImage = nil;
    search.backgroundColor = [UIColor clearColor];

but this is what i get :

enter image description here

what am i doing wrong ? how do i get rid of the extra grey edges on the sides of the textField ?

Upvotes: 0

Views: 172

Answers (1)

Woodstock
Woodstock

Reputation: 22966

You can achieve that with the following code:

search.barTintColor = [UIColor clearColor];

Upvotes: 2

Related Questions