uibarbuttonitem

UIBarButtonItem Title Text is Always Global Tint Color

醉酒当歌 提交于 2019-12-10 22:41:10
问题 iOS 7.0 and up. In AppDelegate.m, I'm setting my global tintColor: self.window.tintColor = myGlobalTintColor; . In my table view controller where I want a red trash can button in the navigation bar while editing the table view cells, I have this: - (void)setEditing:(BOOL)editing animated:(BOOL)animate { [super setEditing:editing animated:animate]; if (editing) { // Start editing self.deleteBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target

How to programmatically disable/enable a UIBarButtonItem

南楼画角 提交于 2019-12-10 21:29:34
问题 I currently have a button called continueButton that has been assigned to a UIBarButtonItem button in a Storyboard file. I've declared the button as such: - (IBAction)continueButton; When the view loads, I want the button to disable itself, so that there can be no user input unless a command is called that re-enables user input for the button. How would I go about doing this? I'm trying to use the function [continueButton setEnabled:YES]; to disable/enable the button programmatically, but it

UIBarButtonItem with separate portrait and landscape images - layoutSubviews not called when popping a view controller from UINavigationController

大憨熊 提交于 2019-12-10 20:08:02
问题 I want to show completely custom buttons in UINavigationController's UIToolbar, and support portrait and landscape . Currently I have implemented a RotatingButton (a UIView subclass) class, which contains one UIButton that fills the whole RotatingButton frame. A RotatingButton also contains two images, for portrait and landscape orientations, and the heights of these images differ. Then this RotatingButton gets wrapped into UIBarButtonItem as a custom view. Currently, in RotatingButton's

How to add button to navigation controller

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 18:05:46
问题 Here is my code..I am unable to add a button in my navigation controller. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. UIViewController *viewController1, *viewController2, *viewController3,*viewController4; viewController1 = [[ViewController alloc] initWithNibName:@"ViewController" bundle

Add NSAttributedString to UIBarButtonItem

南楼画角 提交于 2019-12-10 17:33:22
问题 I'm attempting to set an attributed string on my back bar button item. This is my first attempt at attributed strings. Here is the code: self.navigationItem.hidesBackButton = true let barButtonBackStr = "< Back" var attributedBarButtonBackStr = NSMutableAttributedString(string: barButtonBackStr as String) attributedBarButtonBackStr.addAttribute(NSFontAttributeName, value: UIFont( name: "AmericanTypewriter-Bold", size: 18.0)!, range: NSRange( location:0, length:1)) let newBackButton =

Custom UIBarButtonItem with quartz

情到浓时终转凉″ 提交于 2019-12-10 16:07:08
问题 How can I draw a button with quartz that has exactly the same style as a UIBarButtonItem. The button should be able to show different colors. I downloaded the Three20 project, but this project is really complex, you'd need a lot of time to overlook the whole framework. I just want to draw a custom UIBarButtonItem. Thanks for help. 回答1: If you are using the Three20 library, I guess TTButton's "toolbarButton" style is what you want. TTButton is a sub-class of UIButton, but it allows you to

UIBarButtonItem changes font after being pressed, specified in appearance proxy

大兔子大兔子 提交于 2019-12-10 14:37:44
问题 I set up UIBarButtonItem title font through appearance proxy in AppDelegate: [[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Segoe Print" size: 14.0], UITextAttributeFont, DEF_TITLE_COLOR,UITextAttributeTextColor, [UIColor colorWithRed:100/255 green:128/255 blue:43/255 alpha:0.4], UITextAttributeTextShadowColor, [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, nil] forState

How to fire hightlight effect on UIBarButtonItem

戏子无情 提交于 2019-12-10 14:21:29
问题 When you tap on a UIBarButtonItem in a UIToolbar , there is a white glow effect. Is there a possibility to fire an event to show this effect? I don't want to press the button. Only the effect should be displayed. I want to visualize to the user, that there is new content behind this button. Thanks for your help! 回答1: The following method assumes you are using the toolbarItems property of a navigation controller and that the button you want to highlight is the last item in that array. You can

Custom back button title and keep the swipe back gesture

狂风中的少年 提交于 2019-12-10 13:46:30
问题 Problem : I would like to custom the navigation back button title in the popped view controller like Whatsapp ( < Chats (2) / < Chats (3) ). However to assign a new backBarButtonItem in the popped view controller will disable the swipe back gesture, if you use self.navigationController.interactivePopGestureRecognizer.delegate = self; to keep the gesture work, it will give you more troublessss (too many bugssss). 回答1: You have to set the self.navigationItem.backBarButtonItem property on the

How can I add multiple UIBarButtonItem's to a UINavigationBar?

允我心安 提交于 2019-12-10 12:56:55
问题 I want to add many UIBarButtonItem 's to a UINavigationbar , not just right and left buttons: logoButton = [[UIBarButtonItem alloc] initWithTitle:@"A Button" style:UIBarButtonItemStyleBordered target:self action:@selector(logoButtonAClicked:)]; logoButton2 = [[UIBarButtonItem alloc] initWithTitle:@"B Button" style:UIBarButtonItemStyleBordered target:self action:@selector(logoButtonBClicked:)]; logoButto3 = [[UIBarButtonItem alloc] initWithTitle:@"C Button" style:UIBarButtonItemStyleBordered