Questions tagged [uibarbuttonitem]

UIBarButtonItem is a button specialized for placement on a UIToolbar or UINavigationBar object. It inherits basic button behavior from its abstract superclass, UIBarItem. The UIBarButtonItem defines additional initialisation methods and properties for use on toolbars and navigation bars. There are some methods for customizing Appearance. Available in iOS 2.0 and later in UIKit.

A bar button item is a button specialized for placement on a UIToolbar or UINavigationBar objects. It inherits basic button behavior from its abstract superclass, UIBarItem. The UIBarButtonItem defines additional initialization methods and properties for use on toolbars and navigation bars.

iOS includes a number of system-provided items with specific icons, but developers can create custom items as well.

Note: UIBarButtonItem is not a descendent of UIView, so many common tasks like applying animations or transforms can be more difficult than you might expect.

UIBarButtonItem Class Reference

2349 questions
0
votes
0 answers

UINavigationBarButtonItem not displaying text from Image

I am using a PDF image for a UINavigationBarButtonItem, but the text from the image is not displaying on the button, and I do not know why. Do I need to use and SVG image format? let liveIcon = UIImage(named: "LiveIcon")?.scaleTo(CGSize(width: 30,…
Noah Iarrobino
  • 1,435
  • 1
  • 10
  • 31
0
votes
1 answer

How to enable QLPreviewController action buttons

I am working on document preview functionality. I have implemented QLPreviewController for document preview. I have successfully implemented a document preview but was not able to see the Action Button icon in the controller. Here code of presenting…
0
votes
1 answer

How to add an action to a UIBarButton programmatically?

I've been creating a small iOS app using Swift just for fun, and I have already decided that I want a notification box (a bell-shaped button you can click on to check if there's any notification), and I also wanted to add the bell-shaped button to…
user17353495
0
votes
1 answer

Issue with clicking vertically aligned Bar Buttons outside of the Navigation Bar

I am trying to align two UIBarButtonItems vertically on the right side of my UINavigationBar. I am using a custom view, and aligning two buttons within that. Here is the code: let rightBarButtonCustomView = UIView(frame: CGRect(x: 0, y: 0, width:…
0
votes
0 answers

How to add background color to UIBarButtonItem?

I have added BarButtonItem using system image "plus.color.fill", then I got small image with background blue colored. How to add background color or how to increase the size of BarButton. I have to get the button like in image below. Currently…
JESTIN SAJI
  • 53
  • 1
  • 15
0
votes
2 answers

How to fix the size of UIBarButtonItem when its font weight changes

Below is a short piece of demo code distilled from my project. It consists of a UINavigationBar, UINavigationItem, and several UIBarButtonItems. Tapping on a barButtonItem highlights it and dims the others. In doing so, it is understandable that the…
Kaplan
  • 91
  • 1
  • 11
0
votes
0 answers

How to set the margin of backBarButtonItem?

How to set the margin of backBarButtonItem ? Using these methods has no effect: backItem.imageInsets = UIEdgeInsets(top: 0, left: 100, bottom: 0, right: 0) backItem.width = 100 self.viewControllers.last?.navigationItem.backBarButtonItem = backItem
MarkMiao
  • 213
  • 1
  • 2
  • 7
0
votes
1 answer

In iOS, is there a way to add (overlay) a subview of a UIBarButtonItem image without it moving the buttons already in the bar?

I have my swift 5 app working and I'm now adding a 'tool tips' feature, explaining what each part of the screen does. The approach I have taken is from an article online - add a subview of grey to dim the background, then to that, add a subview of…
Matt Harg
  • 9
  • 3
0
votes
1 answer

iOS Simulator inconsistent with iPad 2, UIBarButtonItem

So something interesting happened yesterday that I don't know if it's ever happened to someone else. I basically add a UIBarButtonItem to the tool bar based on which tab is selected in the tabbarcontroller. For example, in tab 2, I add it like…
Crystal
  • 28,460
  • 62
  • 219
  • 393
0
votes
1 answer

How do I set the text of a UIBarButtonItem?

I have a UIBarButtonItem with an image on it. How do I set the text under the image either via IB or programmatically? Thanks Deshawn
DeShawnT
  • 479
  • 2
  • 7
  • 12
0
votes
1 answer

Problem with adding button to navigation bar.

I added button on navigation bar. When am navigating from rootviewcontroller to detailedviewcontroller and getting back from detailedviewcontroller to rootviewcontroller. those button which are on navigation bar removed and added to view. That is…
14iphone
  • 21
  • 2
  • 9
0
votes
1 answer

UIBarButton differences between View and tableViewControllers?

I have a tab bar iPhone application. Tab bar #1 has a table view controller. It pushes a detail screen onto the stack. On the top right hand corner there is a UIBarButton that calls and action sheet. This is all built programmatically through code…
Jeremy
  • 161
  • 2
  • 12
0
votes
1 answer

Adding NavBar Button Programatically... But It Won't Show!

I'm adding a UIBarButtonItem programatically, however the damned thing won't add itself to the navigation bar (which was added in IB). Here's the code I'm using to add it: UIBarButtonItem *shareButton = [[UIBarButtonItem alloc]…
Peter Kazazes
  • 3,600
  • 7
  • 31
  • 60
0
votes
2 answers

Swift - How to show a UIActivityIndicatorView at the same location without shifting to the right?

I am trying to show a UIActivityIndicatorView at the same location of the UIBarButtonItem it replaces. It shifts to the right while animating. How can I center it without changing the style? Here is the code: @IBAction func upload(_ sender: Any) { …
0
votes
2 answers

Swift 5 - navigationItem.title not showing

My navigationItem.title behaves in a strange way. When the viewController is pushed on to stack the title is not showing (top image). However, while viewController gets popped, the title becomes visible for a nanosecond or so (see bottom…