开发者

(iPad Dev)Is there a way to deselect the first scope button in a scope bar of a search bar?

开发者 https://www.devze.com 2023-02-17 02:32 出处:网络
The first scope button in a scope bar of a search bar is always selected when the scope bar is appeared.

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; 
    } 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号