uibarbuttonitem

disable tint on custom uibarbuttonitem images

烈酒焚心 提交于 2020-01-11 05:02:10
问题 i have some custom bar button items in my navigation controller. (maximize the image to see the borders better) the above screenshot is how it should look like and how i added the barbutton item image. as you can see, the icon has some darker gradients on top. but since all icons get tinted, this dark gradient gets also tinted white and my icon looks extremely blurry. i just dropped them into my storyboard. is there a way to disable tinting this barbuttonitems? 回答1: In iOS 7, a navigation bar

New view from UIBarButtonItem?

北城以北 提交于 2020-01-07 03:53:11
问题 So I've seen previous questions similar to this but they were of no help. I've read Apple's documentation too but I could not understand where I've gone wrong. AFAIK I did everything logically, but when I click on my done button on an UItoolbar overlay, the button can be pushed but it does not do anything. This obviously means it fails to acknowledge the written code. But how? I want to bring up the .nib of "TableViewController" when a done button is clicked on my UIToolBar. But the below isn

How do I programmatically get the state of UIBarButtonItems?

浪尽此生 提交于 2020-01-05 15:16:51
问题 With a UIControl such as a UIButton you can use something like myControl.state to figure out whether the control is currently being pressed down. However, I need to do the same with some UIBarButtonItems (which are not derived from UIControl ), so that I can stop my table from editing while one of them is pressed down. Here's my code: - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { //other checks for(int b=0; b<self.toolbar.items.count; b++) {

Refresh animation on UIBarButtonItem

送分小仙女□ 提交于 2020-01-05 08:15:45
问题 I am trying to make a "refresh" animation using a UIBarButtonItem, the problem is that is not only rotating but moving the image up and down a bit. -(void)startRefreshButtonRotationAnimation { CABasicAnimation* rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0]; rotationAnimation.duration = 1; rotationAnimation.cumulative = YES; rotationAnimation.repeatCount = 1000; UIView

Create UIBarButtonItem with back button style

别来无恙 提交于 2020-01-04 04:00:32
问题 I'm looking for a way to create programmatically an UIBarButtonItem that looks like a back button of UINavigationBar . Apparently seems like that the back button appears only after a push on the UINavigationController . So I'm able to insert only a button with the "cancel" style. But my goal is to create a button with the "New Item" style. Ideas ? 回答1: the short answer is you cannot do it. you can save an image and you can put the image to that position, but the back button is managed by

iOS: How to set the proper image scale for a bar button item

拜拜、爱过 提交于 2020-01-03 09:08:18
问题 I'm trying to add my own image as a bar button item, but I don't know how to get the image to scale properly. Apple's Human Interface guidelines recommends that my image be 44x44 px, but when I use a 44x44 px image, it is too large for the toolbar, as you can see: When I use a smaller version of the image, it looks pixellated on the Retina display. What am I supposed to do here? 回答1: In images.xcassets, you can add the images as 1x, 2x and 3x. Xcode will use the appropriate image size

setBackgroundImage for UIBarButtonItem via appearance not working for other UIControlStates

本秂侑毒 提交于 2020-01-03 03:29:05
问题 I'm trying to customize a UIBarButtonItem using the appearance method (>iOS 5.0). It works fine for the UIControlStateNormal, but not for highlighted or disabled. See images Here's the code I use to set those: // now configure the UIBarButtonItems UIImage *buttonBGInactive = [[UIImage imageNamed:@"button-navbar-30-inactive.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; UIImage *buttonBGActive = [[UIImage imageNamed:@"button-navbar-30-pressed.png"]

uinavigationController's toolbar with custom items

我怕爱的太早我们不能终老 提交于 2020-01-03 02:30:12
问题 I am trying to use the NavigationController's toolbar in my app. This toolbar's toolbarItems are suppose to change depending on which view controller is presented. this is very basic. What I am trying to do is to add custom buttons to the toolbar using the UIBarButtonItem's "initWithCustomView:" method. However, the button won't show up on the toolbar. But if I create the UIBarButtonItem using the "initWithTitle:" or "initWithBarButtonSystemItem:" method, the button show up. For example, look

How can I make the text of a UIBarButtonItem wrap to two lines?

为君一笑 提交于 2020-01-03 00:52:28
问题 Some of the titles of view controllers in my UINavigationController are quite long, which makes the back button in the navigation bar of the next view controller in the hierarchy miss out some of the text, with a "..." instead. How could I make the text of the back button wrap onto two lines, as with "Now Playing" in the navigation bar of iPod.app? Thanks! 回答1: You could use the UIBarButtonItem method initWithCustomView: then set the rightBarButtonItem property in UINavigatiobItem. 来源: https:

Change UIBarButtonItem Icon after pressed iOS swift

家住魔仙堡 提交于 2020-01-02 17:25:22
问题 In the viewDidload method, I've declared a button and set RightBarButton... let btnFavourite = UIButton(frame: CGRectMake(0,0,30,30)) btnFavourite.addTarget(self, action: "btnFavourite:", forControlEvents: .TouchUpInside) btnFavourite.setImage(UIImage(named: "star"), forState: .Normal) btnFavourite.setImage(UIImage(named: "star_filled"), forState: .Highlighted) let rightButton = UIBarButtonItem(customView: btnFavourite) self.navigationItem.setRightBarButtonItems([rightButton], animated: true)