UIBarButtonItem with UIImage Always Tinted iOS 7

I spent an evening trying to figure this out as well. You were very close to the solution. The trick is to instantiate the UIImage with the rendering mode. Instead of doing: UIImage *image = [UIImage imageNamed:@”myImage.png”]; image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; do this: UIImage *image = [[UIImage imageNamed:@”myImage.png”] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; and it works! In my case, … Read more

How can I add a toolbar above the keyboard?

UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 50)]; numberToolbar.barStyle = UIBarStyleBlackTranslucent; numberToolbar.items = [NSArray arrayWithObjects: [[UIBarButtonItem alloc]initWithTitle:@”Cancel” style:UIBarButtonItemStyleBordered target:self action:@selector(cancelNumberPad)], [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], [[UIBarButtonItem alloc]initWithTitle:@”Done” style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)], nil]; [numberToolbar sizeToFit]; phonenumberTextField.inputAccessoryView = numberToolbar; To Dismiss Keyboard: [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]; Swift 3: let numberToolbar = UIToolbar(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, … Read more

Set rootViewController of UINavigationController by method other than initWithRootViewController

You can solve this by calling setViewControllers. Like this: UINavigationController *navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[MyNavigationBar class] toolbarClass:[UIToolbar class]]; [navigationController setViewControllers:@[yourRootViewController] animated:NO]; Swift version: let navigationController = UINavigationController(navigationBarClass: MyNavigationBar.self, toolbarClass: UIToolbar.self) navigationController.setViewControllers([yourRootViewController], animated: false)

How to draw a transparent UIToolbar or UINavigationBar in iOS7

Swift 3 (iOS 10) Transparent UIToolbar self.toolbar.setBackgroundImage(UIImage(), forToolbarPosition: .any, barMetrics: .default) self.toolbar.setShadowImage(UIImage(), forToolbarPosition: .any) Transparent UINavigationBar self.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationBar.shadowImage = UIImage() self.navigationBar.isTranslucent = true Swift < 3 Transparent UIToolbar self.toolbar.setBackgroundImage(UIImage(), forToolbarPosition: UIBarPosition.Any, barMetrics: UIBarMetrics.Default) self.toolbar.setShadowImage(UIImage(), forToolbarPosition: UIBarPosition.Any) Transparent UINavigationBar self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default) self.navigationBar.shadowImage = UIImage() self.navigationBar.translucent = true Objective-C Transparent UIToolbar [self.toolbar setBackgroundImage:[UIImage new] … Read more

Aligning UIToolBar items

Add two UIBarButtonSystemItemFlexibleSpace items to your toolbar, to the left and right of your items UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; [toolbar setItems:[NSArray arrayWithObjects:flexibleSpace, settingsButton,deleteButton,aboutButton, flexibleSpace, nil]]; Adding these as you would any other toolbar items will distribute space evenly between the two of them.

How do I show/hide a UIBarButtonItem?

Save your button in a strong outlet (let’s call it myButton) and do this to add/remove it: // Get the reference to the current toolbar buttons NSMutableArray *toolbarButtons = [self.toolbarItems mutableCopy]; // This is how you remove the button from the toolbar and animate it [toolbarButtons removeObject:self.myButton]; [self setToolbarItems:toolbarButtons animated:YES]; // This is how you … Read more

Creating a left-arrow button (like UINavigationBar’s “back” style) on a UIToolbar

I used the following psd that I derived from http://www.teehanlax.com/blog/?p=447 http://www.chrisandtennille.com/pictures/backbutton.psd I then just created a custom UIView that I use in the customView property of the toolbar item. Works well for me. Edit: As pointed out by PrairieHippo, maralbjo found that using the following, simple code did the trick (requires custom image in bundle) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)