How to hide the navigation bar and toolbar as scroll down? Swift (like myBridge app)

Try this simple approach: Tested in Swift 3 func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { if(velocity.y>0) { //Code will work without the animation block.I am using animation block incase if you want to set any delay to it. UIView.animate(withDuration: 2.5, delay: 0, options: UIViewAnimationOptions(), animations: { self.navigationController?.setNavigationBarHidden(true, animated: true) self.navigationController?.setToolbarHidden(true, animated: true) … Read more

Leaving inputAccessoryView visible after keyboard is dismissed

It’s done like this: Assign your UIToolbar to a property in your view controller: @property (strong, nonatomic) UIToolbar *inputAccessoryToolbar; In your top view controller, add these methods: – (BOOL)canBecomeFirstResponder{ return YES; } – (UIView *)inputAccessoryView{ return self.inputAccessoryToolbar; } And then (optionally, as it usually shouldn’t be necessary), whenever the keyboard gets hidden, just call: [self … Read more

UIToolbar setBackgroundColor doesn’t fully change color

Write below code in your viewDidLoad self.navigationController.toolbar.barTintColor = [UIColor redColor]; It will set red color as your tool bar background. Reference link https://web.archive.org/web/20160321155823/https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW5 In it they said that Use barTintColor to tint the bar background.

iOS 7 | Navigation bar / Toolbar buttons very close to status bar

The navigation bars or toolbars have to be at (0, viewController.topLayoutGuide.length) with bar positioning of UIBarPositionTopAttached. You should set the delegate of your navigation bar or your toolbar to your view controller, and return UIBarPositionTopAttached. If positioned correctly, you will have the result in your third image. More information here: https://developer.apple.com/documentation/uikit/uibarpositioningdelegate?language=objc

How to add a UIToolbar programmatically to an iOS app?

If you’re using UINavigationController then the toolbar comes with it by default. You can add it using following line of code: self.navigationController.toolbarHidden = NO; And to add button to your Toolbar you can use following code: UIBarButtonItem *flexibleItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:nil]; UIBarButtonItem *item2 = … Read more