UISearchBar presented by UISearchController in table header view animates too far when active

Old question but I was able to solve this issue by setting self.extendedLayoutIncludesOpaqueBars = YES; on my view controller. I think is issue is caused by having an opaque navigation bar but setting hidesNavigationBarDuringPresentation to NO on your search controller, causing the search bar to incorrectly position itself when focused.

Can the height of the UISearchbar TextField be modified?

override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) for subView in searchBars.subviews { for subsubView in subView.subviews { if let textField = subsubView as? UITextField { var bounds: CGRect bounds = textField.frame bounds.size.height = 35 //(set height whatever you want) textField.bounds = bounds textField.borderStyle = UITextBorderStyle.RoundedRect // textField.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight textField.backgroundColor = UIColor.redColor() // textField.font … Read more

UISearchbar keyboard search button Action

Add UISearchBarDelegate in .h Also set SearchBar’s object delegate to self. Add this to the UISearchBarDelegate’s method: – (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [searchBar resignFirstResponder]; // Do the search… } Swift func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { searchBar.resignFirstResponder() }

UISearchbar clearButton forces the keyboard to appear

This is an old question and I just came across the same issue and managed to solve it the following way: When the searchBar:textDidChange: method of the UISearchBarDelegate gets called because of the user tapping the ‘clear’ button, the searchBar hasn’t become the first responder yet, so we can take advantage of that in order … Read more

How to animate add UISearchBar on top of UINavigationBar

I’ve modified Mark’s answer a little to get it to work in IOS 8 and in swift. class ViewController : UIViewController, UISearchBarDelegate { var searchBar = UISearchBar() var searchBarButtonItem: UIBarButtonItem? var logoImageView : UIImageView! override func viewDidLoad() { super.viewDidLoad() // Can replace logoImageView for titleLabel of navbar let logoImage = UIImage(named: “logo-navbar”)! logoImageView = UIImageView(frame: … Read more

How to implement UISearchController in UITableView – Swift

Yes, the way search works has been radically changed for what I consider to be a better system. The new system is much better and straight to the point for most simple implementations. Using it is pretty straightforward. First, make your class comply with the UISearchResultsUpdating protocol. class MyTableViewController: UITableViewController, UISearchResultsUpdating {} Add it the … Read more

UISearchBar text color change in iOS 7

In iOS 7 to access Text Field you have to reiterate on level more. Change your code like this for (UIView *subView in self.searchBar.subviews) { for (UIView *secondLevelSubview in subView.subviews){ if ([secondLevelSubview isKindOfClass:[UITextField class]]) { UITextField *searchBarTextField = (UITextField *)secondLevelSubview; //set font color here searchBarTextField.textColor = [UIColor blackColor]; break; } } } Note : This … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)