(iPad Dev)Is there a way to deselect the first scope button in a scope bar of a search bar?
The first scope button in a scope bar of a search bar is always selected when the scope bar is appeared. Is there a way to deselect the button when it appears? (I want to do i开发者_开发百科s deselect all the buttons)
Just set selectedScopeButtonIndex
property of UISearchBar
to -1
.
for (id view in [searchBar subviews])
{
if ([view isMemberOfClass:[UISegmentedControl class]])
{
UISegmentedControl scopeBar = (UISegmentedControl)view;
scopeBar.selectedSegmentIndex = -1;
}
}
精彩评论