替代文字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]; }
然而,当你触摸取消按钮,界面会闪烁,然后回到原来的tableview白色。 这怎么能解决?