Navigation Menu

Skip to content

Commit

Permalink
Updated travis.yml and updated search example for iOS11
Browse files Browse the repository at this point in the history
  • Loading branch information
hackiftekhar committed Mar 14, 2018
1 parent 520afdd commit 7c71fc6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -5,7 +5,7 @@ matrix:
only:
- master
os: osx
osx_image: xcode9
osx_image: xcode9.2
xcode_workspace: Demo.xcworkspace
xcode_project: Demo.xcodeproj
xcode_scheme: DemoObjC
Expand All @@ -22,7 +22,7 @@ matrix:
only:
- master
os: osx
osx_image: xcode9
osx_image: xcode9.2
xcode_workspace: Demo.xcworkspace
xcode_project: Demo.xcodeproj
xcode_scheme: DemoSwift
Expand Down
7 changes: 5 additions & 2 deletions Demo/Objective_C_Demo/ViewController/SearchViewController.m
Expand Up @@ -41,8 +41,11 @@ - (void)viewDidLoad {
self.searchController.searchBar.delegate = self;
[self.searchController.searchBar sizeToFit];

self.tableView.tableHeaderView = self.searchController.searchBar;
self.definesPresentationContext = YES;
if ([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion >= 11) {
self.navigationItem.searchController = searchController
} else {
self.tableView.tableHeaderView = self.searchController.searchBar
}
}

- (void)searchForText:(NSString *)searchText scope:(NSInteger)scopeOption
Expand Down
12 changes: 8 additions & 4 deletions Demo/Swift_Demo/ViewController/SearchViewController.swift
Expand Up @@ -23,18 +23,22 @@ class SearchViewController: UITableViewController, UISearchResultsUpdating, UISe

var filteredList = [[String:String]]()

let searchController = UISearchController()
var searchController : UISearchController!

override func viewDidLoad() {
super.viewDidLoad()

self.searchController = UISearchController(searchResultsController: nil)
self.searchController.searchResultsUpdater = self
self.searchController.dimsBackgroundDuringPresentation = false
self.searchController.searchBar.scopeButtonTitles = ["All", "Name", "Email"]
self.searchController.searchBar.delegate = self
self.searchController.searchBar.sizeToFit()
self.tableView.tableHeaderView = self.searchController.searchBar
self.definesPresentationContext = true
if #available(iOS 11.0, *) {
navigationItem.searchController = searchController
} else {
self.tableView.tableHeaderView = self.searchController.searchBar
}
}

override func viewDidAppear(_ animated: Bool) {
Expand Down

0 comments on commit 7c71fc6

Please sign in to comment.