Can background or borders be removed from UISearchBar?

Can borders be removed from UISearchBar?


enter image description here

enter image description here


enter image description here



in Xcode

[[[searchBar subviews] objectAtIndex:0] setHidden:YES];
for (id img in searchBar.subviews)
{
if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
{
[img removeFromSuperview];
}
}
------------------------------------------------------------
in (void)viewDidLoad of ViewController.m
- (void)viewDidLoad{
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = self.editButtonItem;
_searchBar = (UISearchBar *)[_TableCell viewWithTag:777];
[[[_searchBar subviews] objectAtIndex:0] setHidden:YES];
for (id img in _searchBar.subviews)
{
if([img isKindOfClass:NSClassFromString(@"UISearchBarBackground"(])
{
[img removeFromSuperview];
}
}
}
--------------------------------------------------------------
in @interface ViewController of ViewController.h 
#import <UIKit/UIKit.h>
@interface UIViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, weak) IBOutlet UISearchBar * searchBar;
@end
in (void)viewDidLoad from ViewController.m implement same @interface ViewController.h
[_searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"filename.png/jpg"]; forState:UIControlStateNormal];
GoodLuck ;)

cd:http://stackoverflow.com/questions/10936566/can-background-or-borders-be-removed-from-uisearchbar

Comments

Popular posts from this blog

รู้จักกับ Breakpoints ใน Responsive Web Design

IS-IS & OSPF

RIP Routing Information Protocol