2014-10-10 3 views
4

저는 iPad 응용 프로그램에 있습니다. 스코프 바를 오른쪽에서 내 UISearchBar로 다른 위치로 옮길 수 있는지 알고 싶습니다. 내가 좋아하는 것UISearchBar 범위 막대 위치?

enter image description here

내 검색 바에서 내 범위 막대가 있습니다. 그게 가능하니?

미리 감사드립니다.

+0

여기에 지금 같은 문제, 매우 관심과 해결책이 없습니다 – webo80

+0

여기 내 질문이 있습니다 : http://stackoverflow.com/questions/33390408/positioning-of-scope-bar-in-uisearchcontroller – webo80

+0

Ive done this 내 "고유 한"분할 컨트롤을 만들어 범위 막대와 동일한 기능을 구현했습니다. – derdida

답변

2

좋아,이게 내 해결책이다. Ill는 검색 범위에 대한 가능성을 창출하기 위해 자체적으로 세분화 된 컨트롤을 구현했습니다. 여기

let categories = ["Scope1", "Scope2", "Scope3"] 
    segmentedControl.addTarget(self, action: "changeScope:", forControlEvents: .ValueChanged) 
    segmentedControl.frame = CGRectMake(8, 5, 800, 30) 
    segmentedControl.backgroundColor = UIColor.whiteColor() 
    segmentedControl.tintColor = UIColor.darkGrayColor() 

    // add it in a scrollView, because ill got too much categories here. Just if you need that: 

    scrollView.contentSize = CGSizeMake(segmentedControl.frame.size.width + 16, segmentedControl.frame.size.height-1) 
    scrollView.showsHorizontalScrollIndicator = false; 
    // set first category 
    segmentedControl.selectedSegmentIndex = 0 
    scrollView.addSubview(segmentedControl) 

, 당신은 사용자가 범위를 전환 할 때 원하는 wantever 할 범위 막대의 기능입니다 : 내 경우

func changeScope(sender: UISegmentedControl) { 
    switch(sender.selectedSegmentIndex) { 
    } 
} 

을, 병은 Webservice를에서 여러 resultArrays있어, 아픈 만 표시 선택한 결과 (일반적으로 1 거대한 결과 집합에 추가)

희망이 다른 사람이 도움이됩니다.

+0

나는 다소 영감을받은 버전을 만들었으므로 ... 감사합니다! :) – webo80