uibarbuttonitem

Navigation bar button image not showing in Swift

筅森魡賤 提交于 2019-12-01 15:34:26
I'm back again. I'm writing an app in Swift using Xcode 7. I've added a navigation controller and on top of that a navigation item, and then a bar button. I'm trying to change the image of the bar button to a png that I've imported into Xcode. However, it just shows this in the design and also when I run the app. It just shows a blue smudge in the navigation area. I've tried importing the image into the project and also into images.xcassets with the same results. Anyone know what may be wrong here? Here's the image I've been trying to add and the settings I currently have. Settings: Nicholas

make a UIBarButtonItem with customView behave like Flexible-Space item

与世无争的帅哥 提交于 2019-12-01 15:07:46
I have a UIBarButtonItem that has a UITextField as its customView. The toolbar contains this item and a few buttons. As the toolbar resizes (say on a device-orientation change) I want the UITextField to grow or shrink (width) to occupy all the available space in the toolbar. Short of figuring out the combined sizes of all the buttons in the toolbar, then setting the UITextField width appropriately, is there just some magical way to make this item behave like a flexible-space bar item? If you set UIViewAutoresizingFlexibleWidth to your textfield it should automatically shrink or grow. Oded Ben

make a UIBarButtonItem with customView behave like Flexible-Space item

守給你的承諾、 提交于 2019-12-01 14:46:20
问题 I have a UIBarButtonItem that has a UITextField as its customView. The toolbar contains this item and a few buttons. As the toolbar resizes (say on a device-orientation change) I want the UITextField to grow or shrink (width) to occupy all the available space in the toolbar. Short of figuring out the combined sizes of all the buttons in the toolbar, then setting the UITextField width appropriately, is there just some magical way to make this item behave like a flexible-space bar item? 回答1: If

How to make a UIBarButtonItem like this

强颜欢笑 提交于 2019-12-01 09:10:36
How can I make a UIBarButtonItem like this: I can't find it in the SystemItem values. Thanks That's probably using something like: [[UIBarButtonItem alloc] initWithImage:@"info.png" style:UIBarButtonItemStyleBordered target:nil action:nil] I tried with: UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:[UIButton buttonWithType:UIButtonTypeInfoLight]]; item.style = UIBarButtonItemStyleBordered; but it seems like with a custom view the bordered style doesn't get applied. The Image button which you have called info button.It's an system button, Use below to get it as your

How can I add the 'Glow effect' to UIBarButtonItem?

旧时模样 提交于 2019-12-01 09:05:34
I tried a lot to find out the glow effect for UIBarButtonItem. Now am doing by creating a UIButton and making it as the customView for the UIBarButton. Do anyone have any other methods to make it much more easier? (like a inbuilt property for UIBarButtonItem) You mean the effect you get when you touch an button? That is a property on an UIButton (also accessible from Interface Builder); @property(nonatomic) BOOL showsTouchWhenHighlighted So... UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.showsTouchWhenHighlighted = YES; If you write a subclass of UIBarButtonItem

Rotate UIBarButtonItem

前提是你 提交于 2019-12-01 08:58:54
I want to rotate a UIBarButtonItem . I have been able to do this with UIButton s using setTransform:CGAffineTransformMakeRotation(…) , but UIBarButtonItem does not have this property. I know the Camera-app does this, so it should be achieveable. How can I achieve this? Thanks. Have you tried using a custom view inside the UIBarButtonItem that you then transform any way you want? UIBarButtonItem does not extend UIView, so it cannot be transformed directly. You can add the UIBarButtonItem you wish to transform to a UIToolbar, transform the UIToolbar and then add the toolbar as a custom view to

UIBarButtonItem is blue instead of image

南楼画角 提交于 2019-12-01 08:04:19
Here is what I have in my viewDidLoad method: self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back") self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back") self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil) I am trying to have a custom icon image for my back button in my navigation controller. Instead of the image showing in it's original format, I am seeing the image in blue. How do I get the image to show properly? You can use renderingMode

How can I add the 'Glow effect' to UIBarButtonItem?

旧时模样 提交于 2019-12-01 07:48:42
问题 I tried a lot to find out the glow effect for UIBarButtonItem. Now am doing by creating a UIButton and making it as the customView for the UIBarButton. Do anyone have any other methods to make it much more easier? (like a inbuilt property for UIBarButtonItem) 回答1: You mean the effect you get when you touch an button? That is a property on an UIButton (also accessible from Interface Builder); @property(nonatomic) BOOL showsTouchWhenHighlighted So... UIButton *button = [UIButton buttonWithType

UIBarButtonItem is blue instead of image

谁说胖子不能爱 提交于 2019-12-01 07:12:06
问题 Here is what I have in my viewDidLoad method: self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back") self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back") self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil) I am trying to have a custom icon image for my back button in my navigation controller. Instead of the image showing in it's original

How to make a UIBarButtonItem like this

狂风中的少年 提交于 2019-12-01 07:11:14
问题 How can I make a UIBarButtonItem like this: I can't find it in the SystemItem values. Thanks 回答1: That's probably using something like: [[UIBarButtonItem alloc] initWithImage:@"info.png" style:UIBarButtonItemStyleBordered target:nil action:nil] I tried with: UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:[UIButton buttonWithType:UIButtonTypeInfoLight]]; item.style = UIBarButtonItemStyleBordered; but it seems like with a custom view the bordered style doesn't get applied.