Nis*_*shi 0 background uiimageview uisearchbar ios
在我的iPhone应用程序中,我正在尝试将背景图像设置为UISearch Bar,我的图像未显示.
这是我的代码
UISearchBar * tempSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake( 0, 0, self.view.bounds.size.width, 40 )];
self.searchBar = tempSearchBar;
tempSearchBar.delegate = self;
self.searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
self.searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
self.searchBar.barStyle = UIBarStyleBlack;
self.searchBar.backgroundColor=[UIColor clearColor];
self.searchBar.backgroundImage=[UIImage imageNamed:@"Searchbox.png"];
self.searchBar.placeholder = @"Search My Data";
[self.searchBar sizeToFit];
[self.view addSubview:self.searchBar];
[tempSearchBar release];
Run Code Online (Sandbox Code Playgroud)
[self.searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"Searchbox.png"] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
通过使用上述方法,我可以为searchBar设置bg Image
归档时间: |
|
查看次数: |
4057 次 |
最近记录: |