uibarbuttonitem

Center elements vertically inside UINavigationBar with custom height

前提是你 提交于 2019-12-04 07:40:11
I'm developing an iOS 6 and 7 app that requires the navigation bar to be taller than the usual 44/64 pts I've searched high and low and so far it seems the cleanest solution is to use a category (or subclass) and implement the - (CGSize)sizeThatFits:(CGSize)size method to return a different size. This works fine in just making , however doing this causes all the items inside to rest at the bottom of the navigation bar, while I'd like to have them centered. I have tried using the Appearance Proxy protocol to define vertical offsets for the buttons, specifically this code [[UIBarButtonItem

Creating nib view from UIBarButtonItem?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 06:18:09
问题 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

UIBarButtonItem not reacting after click

拥有回忆 提交于 2019-12-04 05:57:51
问题 From the rootViewController I navigate to a UIViewController if (self.contr == nil) { ExampleViewController *controller = [[ExampleViewController alloc] initWithNibName:@"Example" bundle:[NSBundle mainBundle]]; self.contr = controller; [controller release]; } [self.navigationController presentModalViewController:self.contr animated:YES]; In the UIViewController I have the method -(IBAction) goBack:(id)sender { [self.navigationController dismissModalViewControllerAnimated:YES]; } I added the

UIBarButtonItemStyleBordered is deprecated; what should I do, instead?

天涯浪子 提交于 2019-12-03 23:22:52
I'm trying to create a UIBarButtonItem like this: UIBarButtonItem *discardButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"edit-document.button.discard", "Discard Changes button") style:UIBarButtonItemStyleBordered target:self action:@selector(discardButtonAction:)]; However, I notice that UIBarButtonItemStyleBordered is now deprecated. What should I do, instead? Leo Natan--reinstate Monica Use UIBarButtonItemStylePlain instead. 来源: https://stackoverflow.com/questions/31210776/uibarbuttonitemstylebordered-is-deprecated-what-should-i-do-instead

How to apply borders and corner radius to UIBarButtonItem?

十年热恋 提交于 2019-12-03 23:12:41
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:") emrys57 If you can find the UIView associated with the UIBarButtonItem, you can modify the UIView.layer . But, finding the UIView is not made easy. I used the technique from Figure out UIBarButtonItem frame in

Add custom button to navigation controller without border

喜欢而已 提交于 2019-12-03 19:24:56
问题 I add custom button to navigation controller UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back.png"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)]; self.navigationItem.leftBarButtonItem = backButton; it works fine, but button appears bordered. How can I fix that? UPDATE I found solution UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 25, 25)]; [button setImage:[UIImage imageNamed:@"back.png"]

Transform (rotate) a UIBarButtonItem

点点圈 提交于 2019-12-03 17:07:35
问题 Does anybody know how to transform a UIBarButtonItem ? I tried this but with no results :( It's not working on both UIBarButtonItem and its customview. [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:5.0f]; CGAffineTransform myTransform = CGAffineTransformMakeRotation(M_PI_2); UIBarButtonItem * currentItem = [self.toolbarItems objectAtIndex:4]; currentItem.customView.transform = myTransform; [UIView commitAnimations]; I confirm the transform works on other views (I

How to disable the the light that appears when touching a UIBarButtonItem?

拥有回忆 提交于 2019-12-03 16:32:31
I have a toolbar with a UIBarButtonItem with style: UIBarButtonItemStylePlain . I wonder how can I disable the light that appears while touching it? UIButton has showsTouchWhenHighlighted property but there is no such a thing for UIBarButtonItem is there a work-around you might know? In Interface Builder drag a UIButton to the toolbar. It will create a UIBarButtonItem with a UIButton in it. Set the type of the UIButton to custom. Then you can fully customize the appearence. For example change the text color to white and the background color to transparent and of course disable the highlighting

Rotate UIBarButtonItem Swift

微笑、不失礼 提交于 2019-12-03 16:17:43
In Swift, I have a hamburger bar button, so when tapped I want that hamburger Bar button to rotate 90 degrees (so that the lines are vertical) and then when you click it again I would like it to go back to it's original state (horizontal) NOTE: Can you make sure that this works for a UIBarButtonItem, because some solution to a normal UIButton does not work. I use a UIButton inside of UIBarButtonItem to achieve this, and a variable with state vertical or not this is my storyboard setup Here is the code of simple view controller import UIKit class ViewController: UIViewController { var

Cant set image for UIBarButtonItem

旧城冷巷雨未停 提交于 2019-12-03 12:55:46
I'm trying to set image for my UIBarButtonItem and I can't manage to do that. I tried two times, and in first case I get my image in right place, but when I click on button nothing happens (it should pop out a new window, but nothing works). There is the piece of code I have used: UIImage *faceImage = [UIImage imageNamed:@"plus_button.png"]; UIButton *face = [UIButton buttonWithType:UIButtonTypeCustom]; face.bounds = CGRectMake( 0, 0, faceImage.size.width, faceImage.size.height ); [face setImage:faceImage forState:UIControlStateNormal]; UIBarButtonItem *faceBtn = [[[UIBarButtonItem alloc]