Navigation bar button

When I put two buttons of the right bar in my navigation bar, at the same time, these two buttons are visible, but they have an upper border that I don’t want this border.

I create these buttons in my frame and assign this frame to the navigation bar. Therefore, anyone can help me how to hide this frame.

My code is as follows: -

UIBarButtonItem *btnAdd = [[UIBarButtonItem alloc] initWithTitle:@"Add"
                                                               style:UIBarButtonItemStyleBordered
                                                              target:self
                                                              action:@selector(Add)];

UIBarButtonItem *btnEdit = [[UIBarButtonItem alloc] initWithTitle:@"Edit"
                                                                style:UIBarButtonItemStyleBordered
                                                               target:self
                                                               action:@selector(Edit)];

UIToolbar *rightToolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 46)];
rightToolBar.backgroundColor = [UIColor clearColor];
rightToolBar.tintColor = [UIColor colorWithRed:40.0/255.0 green:48.0/255.0 blue:51.0/255.0 alpha:0.0];
NSArray *buttonsRight = [NSArray arrayWithObjects:btnEdit, btnAdd, nil];
[rightToolBar setItems:buttonsRight];

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightToolBar];

Thanx in Advance.

0
source share
2 answers

Use this

UIBarButtonItem *btnAdd = [[UIBarButtonItem alloc] initWithTitle:@"Add"
                                                               style:UIBarButtonItemStylePlain
                                                              target:self
                                                              action:@selector(Add)];

instead

style:UIBarButtonItemStyleBordered
+1
source

Set frameborder = "0" in the Frame tag, it will disable the frame.

and if u is the link to the button and it shows the border, then use css to rewrite the link properties

a: link {color: # FF0000;}/* unvisited link/ a: visited {color: # 00FF00;}/ / a: hover {color: # FF00FF;}/ / a: active {color: # 0000FF;}/ */

: www.w3schools.com/css

reagards

-1

All Articles