uibarbuttonitem

Making uibarbuttonitems fade

别等时光非礼了梦想. 提交于 2019-12-10 12:39:14
问题 I have a navigation bar that is set up and controlled completely with code. So it does not show up in IB. I have a button appear by "self.navigationitem.rightbarbutton = myButton;" An I make it go away by setting it equal to NIL. What I am wondering is how could I make it fade in and out? 回答1: I found what worked best for me [self.navigationItem setRightBarButtonItem:myButton animated:YES]; And then [self.navigationItem setRightBarButtonItem:nil animated:YES]; To make it fade out. 回答2: Swift

how to set UIBarButtonItem selected or highlighted image or tint colours in iOS 7?

风格不统一 提交于 2019-12-10 12:31:39
问题 How to provide normal state and selected/highlighted state images to uibarbuttonitem in iOS 7? Is there any way to provide tint colour for both normal and selected/highlighted state of uibarbuttonitem? I don't want to use uibutton as a view for uibarbuttonitem! Any elegant solution would be highly appreciated. 回答1: You can use a UIButton as a customView of a UIBarButtonItem and have two different background images for a normal and selected state of the UIButton. Then when the button is tapped

How do I change the back button on a UINavigationControler

我与影子孤独终老i 提交于 2019-12-10 12:04:31
问题 In the view I want to change it for I have the following code but it fails. - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; //Logout button UIBarButtonItem * logout = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(goBack)]; logout.title = @"Logout"; nav_delegate.navigationController.navigationItem.leftBarButtonItem = logout; [logout release]; } Thank you for any help. 回答1: Implementing backBarButtonItem is

How to add a standard info button to a navigation bar in iOS?

对着背影说爱祢 提交于 2019-12-10 09:58:01
问题 I'd like to add a right bar button with the system's info icon to a navigation bar. But I see that UIBarButtonSystemItem does not provide such type of button. On the other hand, so I tried with a UIButton of type UIButtonType.infoLight , but I am not allowed to assign it to navigationItem.rightBarButtonItems . Is there any way to do this? 回答1: this can be achieved using UIButton object of type .infoLight let infoButton = UIButton(type: .infoLight) infoButton.addTarget(self, action: #selector

Auto Layout with UINavigationBar and UIBarButtonItem

好久不见. 提交于 2019-12-10 03:39:33
问题 I like to create my views as standalone Xib files then instantiate them and add as subviews. So, when working with a UINavigationBar , I expected to be able to do the same thing, first creating my custom view - from the Xib - then adding it as a custom view to the UIBarButtonItem : UIBarButtonItem *anItem = [[UIBarButtonItem alloc] initWithCustomView:_myCustomView]; Then adding to the nav bar: self.navigationBar.topItem.rightBarButtonItems = @[ anItem, anotherItem ]; So far so good. Now,

iOS 7 UIBarButtonItem font changes when tapped

ⅰ亾dé卋堺 提交于 2019-12-10 03:06:00
问题 I'm attempting to change my UIBarButtonItem font. It looks good when ViewControllers load. But if I tap on the bar button, or swipe right as if to move to the previous ViewController (but then pull back to the current one), the font changes back to the system font. Here's what I'm setting in my AppDelegate: NSDictionary* barButtonItemAttributes = @{NSFontAttributeName: [UIFont fontWithName:@"SourceSansPro-Light" size:20.0f]}; [[UIBarButtonItem appearance] setTitleTextAttributes:

When changing UIBarButtonItem title, the transition is jerky/flickers

本小妞迷上赌 提交于 2019-12-10 01:23:59
问题 I have a UIViewController subclass. I give the view controller a rightBarButtonItem in viewDidLoad like this: self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Difficulty" style:UIBarButtonItemStylePlain target:nil action:nil]; When the user presses another button in the view, the title/text of the UIBarButtonItem is changed like this: self.navigationItem.rightBarButtonItem.title = @"Mellansvår"; It works fine, but when the title is changed, it doesn't look

Is there an easy way to change the text color of a UIBarButtonItem without using an image?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 00:57:12
问题 Is there an easy way to change the text color of a UIBarButtonItem without using an UIImage as the background? By default the text is always white. I'd like to make it black. 回答1: The direct answer to your question is no. You can't simply change the color of a UIBarButtonItem by setting one of its properties. You can set the tintColor property of the UIToolBar or UINavigationBar that contains the UIBarButtonItem s, but that also affects the color of the toolbar itself and doesn't offer too

Constraint a UIBarButtonItem's size in the navigaiton bar with iOS 11

北城以北 提交于 2019-12-09 22:50:10
问题 I try to set UIBarButtonItem with different size images in the navigation bar. So I create a UIBarButtonItem based custom view and set the custom view's frame to constraint the UIBarButtonItem's width. It had been working well before I updated the software to iOS 11. That set custom view's frame to constraint the UIBarButtonItem's width seems no longer useful on iOS 11. I used the image defaultImage with 120*120: UIButton *leftCustomButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 35

How to apply borders and corner radius to UIBarButtonItem?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 14:14:27
问题 I have programatically created a toolbar to which I have added a UIBarButtonItem. This is what is currently looks like: I want the the button to have a border and a corner radius(curved corners). How will the same be implemented? UIBarButtonItem Implementation code: let okBarBtn = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: "donePressed:") 回答1: If you can find the UIView associated with the UIBarButtonItem, you can modify the UIView.layer . But,