开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜