uitoolbar

inputAccessoryView's UIToolbar turns black when rotating in iOS

≡放荡痞女 提交于 2019-12-05 06:23:05
Here is my code: override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let keyBoardToolBar = UIToolbar(frame: CGRectMake(0, 0, self.view.frame.size.width, 44)) keyBoardToolBar.barStyle = .Default let flexSpaceKeyboardBarButtonItem = UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: nil, action: nil) let doneKeyboardBarButtonItem = UIBarButtonItem(title: "Done", style: .Done, target: self, action: nil) let wordKeyboardBarButtonItem = UIBarButtonItem(title: "Button 1", style: .Plain, target: self, action: nil) var

UIBarButtonItem Offset?

放肆的年华 提交于 2019-12-05 04:19:18
问题 I am trying to offset the UIBarButtonItems in my app, I need them slightly offset due to the image I use for my navigation bar so it all lines up correctly. I have managed to do this like so: [[UINavigationBar appearance] setTitleVerticalPositionAdjustment:-3 forBarMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setBackgroundVerticalPositionAdjustment:-3 forBarMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setBackButtonBackgroundVerticalPositionAdjustment:-3

Changing the height of UIToolbar in iOS 7

一笑奈何 提交于 2019-12-05 02:01:06
I am trying to change the height of my UIToolbar in a new iOS 7 project but I am not able to. I am using a UINavigationController to manage a couple of UIViewController. I tried setting the frame for the toolbar via the navigation controller but alas, the toolbar property is read-only. I looked at " Is there a way to change the height of a UIToolbar? " but that did not work. I tried subclassing UIToolbar, forcing a custom height and setting the right class in the Storyboard but that did not work neither, height keeps on being 44px. I thought about auto-layout could not set any constraint on

Separator between toolbar items in UIToolbar

女生的网名这么多〃 提交于 2019-12-05 01:52:42
How to add a separator between buttons in a UIToolbar? Sample image is shown in the below link I can think of two ways : (a) You could make them very thin toolbar buttons with user interaction disabled. (b) Your other choice would be to implement your own toolbar. I'd try (a) first ;) I did it with a custom view button, with a 1 pixel wide background: UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 1, 44)]; label.backgroundColor = [UIColor whiteColor]; UIBarButtonItem *divider = [[UIBarButtonItem alloc] initWithCustomView:label]; // Add button to array of toolbar items [items

Change background image of UIToolbar

北城以北 提交于 2019-12-04 20:24:05
How can I change the background image of UIToolbar? I have been able to do this for navigation bar, but not UIToolbar. I do not want to change tintColor. I would like to change the whole image. Thanks for your help. visakh7 From Can I give a UIToolBar a custom background in my iPhone app? Overriding the drawRect function and creating an implementation of the UIToolbar does the trick :) @implementation UIToolbar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"nm010400.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];

UIToolbar in a popover

岁酱吖の 提交于 2019-12-04 19:28:39
Is it possible to show toolbar items in a UIViewController inside a popover? I'm doing this in the viewDidLoad method of my view controller: UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil]; [self setToolbarItems:[NSArray arrayWithObject:addButton]]; [addButton release]; Then I'm wrapping this view controller in a UINavigationController (which has a toolbar property, and according to the docs, I'm supposed to use the setToolbarItems method of UIViewController to add items to the toolbar), then presenting it in a

Transparent UIToolbar

╄→尐↘猪︶ㄣ 提交于 2019-12-04 19:28:19
问题 I wrote the following code to make my toolbar transparent. [mtoolbar setBackgroundColor:[UIColor clearColor]]; How do I make UIToolbar transparent? 回答1: You can set the property translucent to YES and see if this helps. 回答2: [self.toolbar setBackgroundImage:[UIImage new] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault]; [self.toolbar setBackgroundColor:[UIColor clearColor]]; 回答3: Setting the property translucent to YES will not work in iOS 5 and below. Here's how it can

add Toolbar above UITableView for use in UISplitViewController detail view

戏子无情 提交于 2019-12-04 19:19:13
I want to use a table view as the detail pane in my UISplitViewController. How do I put the toolbar at the top? I want to be able to add bar button items in the same way as my non-table detail views. Thanks. My frustration with this problem lay in trying to use the UITableViewController class, which does not allow you to add other UI elements like a toolbar. I solved it by creating a UIViewController object and adding the toolbar and table view to its nib individually. I then had the ViewController implement the table view's delegate and data source methods. Works great. common paradigm is

Can I center a UIToolbar item?

可紊 提交于 2019-12-04 18:37:19
问题 I am putting a label on a UIToolbar (per this tip: Adding a UILabel to a UIToolbar). But the toolbar has a button on the left side, and so flexible spaces throw the label off the center, which is where I'd like it to be. Can I somehow center this toolbar item so that it remains centered in the toolbar? (Already tried balancing the button with a dummy fixed space, no dice.) Thanks! 回答1: Simplest way would be to put the label above the bar, in it's parent view, and justify it there. 回答2: Add a

Problem adding UIBarButtonItems to a ToolBar

眉间皱痕 提交于 2019-12-04 17:15:08
问题 I have a UINavigationController with a UITableViewController in it. I want to show a ToolBar on the bottom with UIBarButtonItem's. The ToolBar is showing up, but the buttons won't appear. Anyone knows why? - (void)viewDidLoad { [super viewDidLoad]; [[self navigationItem] setTitle:@"Selections List"]; [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addProjectSearch:)] autorelease]]; [[self