删除边框导航栏按钮monotouch

时间:2013-07-04 11:35:22

标签: c# ios xamarin.ios xamarin

所以我在按钮上创建了一个带有图像的界面,但默认情况下,apple会在导航栏按钮周围放置边框。是否有一种简单的方法可以删除它们?

enter image description here

2 个答案:

答案 0 :(得分:2)

根据Add custom button to navigation controller without border,您可以

var button = new UIButton (new RectangleF (0, 0, 25, 25));
button.SetImage (new UIImage ("image"), UIControlState.Normal);

NavigationItem.LeftBarButtonItem = new UIBarButtonItem (button);

当然,如果你想控制你的BarButtonItem,你可以这样做:

var button = new UIButton (new RectangleF (0, 0, 25, 25));
button.SetImage (new UIImage ("image"), UIControlState.Normal);

var buttonItem = new UIBarButtonItem (button);
buttonItem.SetTitleTextAttributes(...);
NavigationItem.LeftBarButtonItem = buttonItem;

答案 1 :(得分:2)

在界面构建器中选择一个按钮,在右栏上的属性中,使用背景图像Custom按钮:

enter image description here

enter image description here

添加普通UIButton后,您可以使用Interface Builder Alert(可以使用普通按钮),只需单击一个按钮并将其设置为Bordered custom:

enter image description here

其他点击同一按钮并设置第一个屏幕后;)