Reputation: 14904
I am here on an iPad Application and i would like to know if its possible to move the Scope Bar from right to my UISearchBar to another position?
I would like to have my Scope Bar under my Search Bar. Is that possible?
Thanks in advance.
Upvotes: 4
Views: 739
Reputation: 14904
Ok this is my solution for that. Ill implemented my own segmented control to create a possibility for a search scope.
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)
Here is the function for the scope bar, do wantever you want when a user switches a scope:
func changeScope(sender: UISegmentedControl) {
switch(sender.selectedSegmentIndex) {
}
}
In my case, ill got several resultArrays from an Webservice, and ill only show the selected result (normally ill Add them to 1 huge resultSet)
Hope that helps maybe someone else.
Upvotes: 2