|
@@ -67,41 +67,42 @@
|
|
|
}
|
|
}
|
|
|
self.dirty = false;
|
|
self.dirty = false;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- UILabel* titleLabel= [[UILabel alloc] initWithFrame:CGRectMake(100, 0, 200
|
|
|
|
|
-
|
|
|
|
|
- , 44)];
|
|
|
|
|
- titleLabel.text=self.title;
|
|
|
|
|
- // titleLabel.backgroundColor =[UIColor yellowColor];
|
|
|
|
|
- titleLabel.textAlignment=NSTextAlignmentCenter;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //将搜索条放在一个UIView上
|
|
|
|
|
- UIView *searchView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1768, 44)];
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- searchView.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleWidth;
|
|
|
|
|
-
|
|
|
|
|
- titleLabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
|
|
|
|
|
- titleLabel.center=searchView.center;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- UISearchBar *searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(searchView.frame.size.width-200.0f-8.0f,0.0f,200.0f,44.0f)];
|
|
|
|
|
- searchBar.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
|
|
|
|
|
- searchBar.delegate = self;
|
|
|
|
|
- [searchBar setPlaceholder:@"filter"];
|
|
|
|
|
- //searchBar.barTintColor=[UIColor clearColor];
|
|
|
|
|
- searchBar.searchBarStyle=UISearchBarStyleMinimal;
|
|
|
|
|
- [searchView addSubview:titleLabel];
|
|
|
|
|
- [searchView addSubview:searchBar];
|
|
|
|
|
-
|
|
|
|
|
- self.navigationItem.titleView = searchView;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ NSString *model = [UIDevice currentDevice].model;
|
|
|
|
|
+ if ([model isEqualToString:@"iPhone"]) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ UILabel* titleLabel= [[UILabel alloc] initWithFrame:CGRectMake(100, 0, 200
|
|
|
|
|
+
|
|
|
|
|
+ , 44)];
|
|
|
|
|
+ titleLabel.text=self.title;
|
|
|
|
|
+ // titleLabel.backgroundColor =[UIColor yellowColor];
|
|
|
|
|
+ titleLabel.textAlignment=NSTextAlignmentCenter;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //将搜索条放在一个UIView上
|
|
|
|
|
+ UIView *searchView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 1768, 44)];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ searchView.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleWidth;
|
|
|
|
|
+
|
|
|
|
|
+ titleLabel.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
|
|
|
|
|
+ titleLabel.center=searchView.center;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UISearchBar *searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(searchView.frame.size.width-200.0f-8.0f,0.0f,200.0f,44.0f)];
|
|
|
|
|
+ searchBar.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
|
|
|
|
|
+ searchBar.delegate = self;
|
|
|
|
|
+ [searchBar setPlaceholder:@"filter"];
|
|
|
|
|
+ //searchBar.barTintColor=[UIColor clearColor];
|
|
|
|
|
+ searchBar.searchBarStyle=UISearchBarStyleMinimal;
|
|
|
|
|
+ [searchView addSubview:titleLabel];
|
|
|
|
|
+ [searchView addSubview:searchBar];
|
|
|
|
|
+
|
|
|
|
|
+ self.navigationItem.titleView = searchView;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
[[self navigationController] setNavigationBarHidden:self.hide_navibar animated:NO];
|
|
[[self navigationController] setNavigationBarHidden:self.hide_navibar animated:NO];
|
|
|
|
|
|