1.LargeTitle:
a. 全局使用:
// if (@available(iOS 11.0, *)) {
// [[UINavigationBar appearance] setPrefersLargeTitles:true];
// } else {
// // Fallback on earlier versions
// }
b.在某個controller中使用:
[self.navigationController.navigationBar setPrefersLargeTitles:YES];
2.ios 10 系統的刷新控件:UIRefreshControl
UIRefreshControl *refreshControl = [[UIRefreshControl alloc]init];
[refreshControl addTarget:self action:@selector(beginRefresh) forControlEvents:UIControlEventValueChanged];
if (@available(iOS 10.0, *)) {
[table setRefreshControl:refreshControl];
} else {
// Fallback on earlier versions
}
-(void)beginRefresh{
if ( [table.refreshControl isRefreshing]) {
[table.refreshControl endRefreshing];
}
}
3.UISearchController
searchController = [[UISearchController alloc]initWithSearchResultsController:nil];
if (@available(iOS 11.0, *)) {
self.navigationItem.searchController = searchController;
self.navigationItem.hidesSearchBarWhenScrolling = false; // 重要,沒有這句,會沒有效果
} else {
table.tableHeaderView = searchController.searchBar;
}