Show search bar in navigation bar without scrolling on iOS 11

The following makes the search bar visible at first, then allows it to hide when scrolling: override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if #available(iOS 11.0, *) { navigationItem.hidesSearchBarWhenScrolling = false } } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if #available(iOS 11.0, *) { navigationItem.hidesSearchBarWhenScrolling = true } } Using isActive didn’t do what … Read more

iPhone: Setting Navigation Bar Title

The view controller must be a child of some UINavigationController for the .title property to take effect. If the UINavigationBar is simply a view, you need to push a navigation item containing the title, or modify the last navigation item: UINavigationItem* item = [[UINavigationItem alloc] initWithTitle:@”title text”]; … [bar pushNavigationItem:item animated:YES]; [item release]; or bar.topItem.title … Read more

How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem?

You need to handle two scenarios: When you’re pushing a new view onto the stack When you’re showing the root view controller If you just need a base class you can use, here’s a Swift 3 version: import UIKit final class SwipeNavigationController: UINavigationController { // MARK: – Lifecycle override init(rootViewController: UIViewController) { super.init(rootViewController: rootViewController) delegate … Read more

back button callback in navigationController in iOS

William Jockusch’s answer solve this problem with easy trick. -(void) viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // back button was pressed. We know this is true because self is no longer // in the navigation stack. } [super viewWillDisappear:animated]; }

Removing the title text of an iOS UIBarButtonItem

To set the back button title for a view controller without changing its title use: Objective-C: self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@”” style:self.navigationItem.backBarButtonItem.style target:nil action:nil]; Swift: navigationItem.backBarButtonItem = UIBarButtonItem(title: “”, style: .plain, target: nil, action: nil) To be clear, this is done on the view controller that you would see if you hit the back button. … Read more

How do I change the title of the “back” button on a Navigation Bar

This should be placed in the method that calls the ViewController titled “NewTitle”. Right before the push or popViewController statement. UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:@”NewTitle” style:UIBarButtonItemStyleBordered target:nil action:nil]; [[self navigationItem] setBackBarButtonItem:newBackButton]; [newBackButton release];

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