i have a ToolBar in my view controller.i need to show one icon in right side of the ToolBar.
so i added a BarButton item and displayed icon image there.but the is a problem with icon color.it displaying as black which is not looking good and also cant able to arrange Barbutton items on right side of the Toolbar.can any one tell me a good way to do it.please help me to arrange barbuttonitems on right side and provide a way to give colors to BarButtonItem.
Use below below change the color of UIToolBar.
//Give your choice of color.
myToolbar.tintColor = [UIColor darkGrayColor];
To align the right button you need to use a bar button of type UIBarButtonSystemItemFlexibleSpace Read SO post.
Aligning UIToolBar items
Related
I have few UIViewControllers embeded in NavigationController, everything is cool when it comes to change screen titles, button titles, hiding/showing navigation bar (top bar) or toolbar (bottom bar), but - I cannot force toolbar buttons to have this animated shadow when pressed, as navigation bar buttons have. What's more, toolbar buttons are as black as toolbar - shouldn't button be slightly lighter color than toolbar?
I hope it's clear, because I couldn't find it nor even come up with reasonable title
If you want a black bar (navigation or toolbar), set its barStyle to UIBarStyleBlack in addition to or instead of tinting it black. This lets it know that the buttons should be tinted differently than if the bar was any other color.
I am not able to understand you whole problem but for the toolbar problem you can give those buttons different colors and also can give an effect of changing color of button which is clicked
UIBarButtonItem *toolBtn = [[UIBarButtonItem alloc] initWithTitle:#"Share and Upload"
style:UIBarButtonItemStyleBordered
target:self
action:#selector(your_Target)];
toolBtn.tintColor = [UIColor redColor];
Now suppose toolBtn is your first button in toolbar and on click of it you want to change its color then in your target function
-(void)your_Target{
UIBarButtonItem *button1 = [[your_Toolbar items] objectAtIndex:0];
button1.tintColor = [UIColor brownColor];
// or you can simply loop all toolbar buttons and change the color of only clicked one and for rest keep it default
}
Hope this will help you.. and sorry for my bad english :)
Can I add an icon to the uisearch bar like this
Ya you can add the icon if you are talking about the image on left then just add a image and if you are talking about the image to the right. which i think is a search button then you can add a button and do your search code on it.
ok so what you have to do now is, i am assuming that you want to implement the search bar with icon on the toolbar. just add a UIButton and in the IB select the UIButton and go to attribute inspector and set the type to custom.
Now when you add the image to it(set the background property to the image you have selected)
By doing this you can easily resize your image.(means just resize the button, it will automatically resize your image too).
hope this will work.
I have a UITableView with a navigation bar on the top. I changed the style of the navigation bar to Black Opaque to go with my theme.
I added an edit button as well using the below line of code
self.navigationItem.leftBarButtonItem = self.editButtonItem;
All is fine so far, the edit button also appears in the balck opaque style.
however the done button appears in the default blue theme. Am i missing some simple thing? How should i change it?
Help would be appreciated
The done button is always blue on a UIBlackBarStyle Navigation bar, but will adjust its color if you use the tintColor property of the navigationBar to color it in your chose of colors. I haven't tried it, but an idea would be to set
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
this should give you a Black navigation bar with a black done Button.
However, for consistency reasons you can not directly set your custom background color on the done button.
How to change color of leftBarButtonItem of UIBarButtonItem in NavigationBar?
if I am trying to set image in bar button through interfaceBuilder it shows border on image in bar button so is there any specific size for image for bar button or how to set image with-out showing border in it ?
If I am adding BarButton dynamically it doesn"t appear while running App
and if I am adding leftbarButton in xib only and connecting outlets then the leftbar button become visible but I am not able to assign customview view to it my ultimate goal is to change the color of left bar buttton
Please Help and Suggest,
Thanks
Create the bar buttom item with a custom view using -[UIBarButtonItem initWithCustomView:]. That way, you have all the control you want over the appearance.
I think you can use:
- (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action
You can set custom image for your bar button.
If it's just the colour you want to change, add the button to the bar and then set the tint colour of the bar (see docs on UINavigationBar or UIToolBar). This of course changes the bar colour as well as the button however, but it's good practice (UI consistency wise) to use the same colour for UIBarButtonItems and their bars especially if you're using out-of-the-box buttons.
I've seen other apps are using a round icon for closing a view. The only similar icon I found is UIBarButtonSystemItemStop. But this presents only a rotated cross with a border (as always with buttons) around it.
I rather would like have something like a UIButtonTypeInfoLight. If this button is used, no border is visible. Also the icon is a round grey icon with a symbol (here i symbol) in it. Are there further icons in this style available? Neither UIBarButtonSystemItem nor UIButtonType is offering that.
I have also seen a thunderbolt icon in the style of UIButtonTypeInfoLight. Are these icons self made? If yes, how are they included so that no border is visible?
These buttons are custom.
You can embed any custom view into bar using [UIBarButtonItem initWithCustomView:].
You can use UIButton with UIButtonTypeCustom type so that you have button with no border. Also set showsTouchWhenHighlighted to YES so that button glows like info button.