【发布时间】:2013-06-18 14:52:53
【问题描述】:
我正在寻找一个带有左侧按钮的 UiSearchBar。 我一直在阅读 this topic,并按照 KennyTM 描述的步骤进行操作,但没有得到相同的结果。
这是我得到的:
如您所见,我的搜索栏与导航栏的颜色不同。
有没有人可以解决这个问题?
【问题讨论】:
标签: ios interface-builder uisearchbar
我正在寻找一个带有左侧按钮的 UiSearchBar。 我一直在阅读 this topic,并按照 KennyTM 描述的步骤进行操作,但没有得到相同的结果。
这是我得到的:
如您所见,我的搜索栏与导航栏的颜色不同。
有没有人可以解决这个问题?
【问题讨论】:
标签: ios interface-builder uisearchbar
for( id view in search.subviews) {
if([view isKindOfClass:[UIImageView class]]) {
UIImageView *img = (UIImageView *)view;
img.image = nil;
}
}
search.backgroundImage = [UIImage imageNamed:@"searchbar.png"];
搜索是UISearchbar的对象
【讨论】:
search.backgroundImage = [UIColor clearColor];一起工作正常
/ button
UIBarButtonItem *settingsButtonItem = // create settings button
// search bar
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 260, 44)];
UIBarButtonItem *searchBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:searchBar];
[searchBar release];
// toolbar is UIToolbar
[toolbar setItems:[NSArray arrayWithObjects:settingsButtonItem, searchBarButtonItem nil] animated:NO];
请执行上面的代码可能会有很大帮助。
【讨论】: