2011-03-14 85 views
1

當範圍欄出現時,總是選中搜索欄的範圍欄中的第一個範圍按鈕。 有沒有辦法在按鈕出現時取消選擇? (我想要做的是取消所有的按鈕)(iPad Dev)有沒有辦法在搜索欄的範圍欄中取消選擇第一個範圍按鈕?

+0

爲(在ID視圖[搜索欄子視圖]){ \t \t如果([視圖isMemberOfClass:[UISegmentedControl類]]){ \t \t \t UISegmentedControl * scopeBar =(UISegmentedControl *)視圖; \t \t \t scopeBar.selectedSegmentIndex = -1; \t \t} \t} – 2011-03-15 00:10:19

回答

1
for (id view in [searchBar subviews]) 
{ 
    if ([view isMemberOfClass:[UISegmentedControl class]]) 
    { 
     UISegmentedControl scopeBar = (UISegmentedControl)view; 
     scopeBar.selectedSegmentIndex = -1; 
    } 
} 
4

剛剛成立的UISearchBarselectedScopeButtonIndex屬性-1