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
2 answers

How to fire a UIBarButtonItem tap event manually?

I have a situation where I have a custom UIButton that is a subview of a UIBarButtonItem: guard let tab1 = self.tabBar.items![0].value(forKey: "view") as? UIView else {return} let button2Test = UIButton() tab1.addSubview(button2Test) The…
user13255207
0
votes
3 answers

How do I add a button on right side of the toolbar in a UISplitViewController?

Trying to add a button to the right side of the toolbar of the detailviewcontroller in a split-view based app. I used flexible space to get it to the right side. In portrait it works fine, but in landscape (when the menu button disappears), the…
user617123
  • 463
  • 2
  • 9
  • 26
0
votes
0 answers

How to avoid having two UIPopoverPresentationControllers up at same time each from UIBarButtonItem in UItoolBar

I'm in the process of converting an old iOS app which uses UIPopoverController to the new UIPopoverPresentationController. I have two popovers (A & B) each initiated from a click on a UIBarButtonItem (butA, butB) in a UIToolBar. I have the popovers…
0
votes
2 answers

Why UIBarButtonItem target and action comes nil?

I Want to press UIBarButtonItem programmatically in swift. I looked at the other questions asked in stackoverflow and did the same, but it didn't work.doing what i want when manually clicked but I need click programmatically. My example code…
user9413194
  • 119
  • 2
  • 3
  • 9
0
votes
3 answers

Set UIBarButtonItem with circular Image profile

How to set UIBarButton with circular image profile func loadProfile(){ let url = URL(string: "https://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg")! let data = try! Data(contentsOf: url) let img = UIImage(data: data) let…
kiran
  • 4,285
  • 7
  • 53
  • 98
0
votes
1 answer

How to execute func present in a ViewController from another?

I am a beginner in Swift, and I do not yet understand all the elements. I am trying to execute a function present in a ViewController (ProjectTabBarController) from another ViewController (ProjectInfosViewController). I end up with an error when I…
nlrdn
  • 3
  • 1
0
votes
2 answers

Adjusting the Size of a UIToolBar Button to the Size of a Custom Image with Interface Builder

I have added a bar button item to my UIToolBar in Interface Builder (Style: Plain, Identifier: Custom, Image: FaceBook_Icon.png). I desire to set the button size to the size of my custom image (40x40), however, adjusting the bar item size in the IB…
JRoss
  • 177
  • 10
  • 23
0
votes
2 answers

UIBarButtonItem Tittle text alignment

I'm using UIBarButtonItem title part for a Clock. Every time the second changes the clock moves slightly left/right depending on the size of the character for the seconds part. Is it possible to align the title text left or in some way so that the…
user13332990
0
votes
2 answers

Swift Command to hide Bar Button Item in ViewController with an action in ContainerView?

I have a special question and I doesn't find an answer for my case. I have an embedded ViewController in a navigation controller with a Container View. In this Container View is a scrollView. What I want to do is: When I scroll in my ContainerView…
Lukas
  • 251
  • 2
  • 13
0
votes
1 answer

Unable to handle setEditing method through UIBarButtonItem

I have added a bar button item in my tool bar and I implemented its functionality in the method given below. I am not able, however, to display a delete button in each row. How can I do this? -(void)setEditing:(BOOL)editing …
user720235
  • 85
  • 1
  • 11
0
votes
1 answer

How to control layout of UIBarButtonItem controls on an iOS toolbar?

On my toolbar I am trying to properly lay out three buttons. One in the middle that should remain centered horizontally, and then one aligned left and one aligned right. But because the text for the left button is longer than either the middle…
Alyoshak
  • 2,696
  • 10
  • 43
  • 70
0
votes
2 answers

iphone: add UIBarButtonItem to UIViewController's UINavigationItem.leftBarButtonItem - weak?

I use in my application a tabbar controller and under the first tab is a navigationcontroller. The rootview of the navigation controller stack shows a searchbar to the user, where he can input text. after finishing with his input, the user starts…
0
votes
1 answer

UIBarButtonItem contains shopping cart and no. of items

I have been struggling with this for hours. I am new to Swift so all I want to do is add an image of a shopping cart and a string to the .rightBarButtonItem and I cannot get it. So far I have this: let cartIcon = UIBarButtonItem(image:…
BVB09
  • 805
  • 9
  • 19
0
votes
1 answer

Xamarin iOS adding Custom back button

I want to customise back-button so i can prompt user with confirmation box. For that i have removed default navigation back button by setting its hidden property to 'True' and i am adding new left bar button item. But UI for the left bar button is…
Nikhil Dekhane
  • 101
  • 1
  • 10
0
votes
1 answer

parse of type UITextField to an @objc function during actions

So I want to add done button to my decimalPad so that the user can stop editing. but I need to parse the UITextField to the handleInput function when the done button is pressed. anyone have any ideas if I can parse a UITextField to a objective C…
Petter Braka
  • 311
  • 1
  • 11