代替テキスト http://img210.imageshack.us/img210/5992/searchdisplaycontroller.png
次のオブジェクトはカスタマイズ可能ですか?
1. UISearchBar スコープ ボタン (UISegmentedController)
2.UIResultsTableView
3. キーボード (せめて黒にしよう)
代替テキスト http://img210.imageshack.us/img210/5992/searchdisplaycontroller.png
次のオブジェクトはカスタマイズ可能ですか?
1. UISearchBar スコープ ボタン (UISegmentedController)
2.UIResultsTableView
3. キーボード (せめて黒にしよう)
代替テキスト http://img527.imageshack.us/img527/9775/searchdisplaycontrollerz.png
ある種のハックコードでセグメント化されたコントロールを変更することができました:
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
for (UIView *subview in self.view.subviews) {
for (UIView *subview2 in subview.subviews) {
if ([subview2 isKindOfClass:[UISegmentedControl class]]) {
UISegmentedControl *segmentedControl = (UISegmentedControl *)subview2;
segmentedControl.tintColor = [UIColor blackColor];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
}
}
}}
しかし、ボタンがでかいのですが、オリジナルと同じようにきれいにするにはどうすればよいでしょうか?
また、すべての segmentedControlStyle を試しても、ボタンを小さくすることはできませんでした。少なくともIOS4で色合いを正しくするために使用する必要があったコードは次のとおりです。
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
static BOOL tintAlreadyChanged = NO;
if (tintAlreadyChanged) return;
NSLog(@"Searching subViews for UISegmentControl:");
//fix segmented control
for (UIView *subview in self.view.subviews) {
//NSLog(@"\n\nsubView = %@",subview);
for (UIView *subview2 in subview.subviews) {
//NSLog(@"subView2 = %@",subview2);
for (UIView *subview3 in subview2.subviews) {
//NSLog(@"subView3 = %@",subview3);
if ([subview3 isKindOfClass:[UISegmentedControl class]]) {
NSLog(@"Found UISegment SubView = %@",subview3);
UISegmentedControl *segmentedControl = (UISegmentedControl *)subview3;
segmentedControl.tintColor = [UIColor blackColor];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBezeled;
tintAlreadyChanged = YES;
}
}
}
}
}
次のコードを使用して、テーブルビューをカスタマイズできました。
- (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView {
tableView.backgroundColor = [UIColor colorWithRed:(19.0 / 255.0) green:(19.0 / 255.0) blue:(19.0 / 255.0) alpha:1.0];
tableView.separatorColor = [UIColor blackColor]; }
ただし、キャンセル ボタンを押すと、元のテーブルビューに戻る前にインターフェイスが白く点滅します。これはどのように修正できますか?