Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 删除边框导航栏按钮monotouch_C#_Ios_Xamarin.ios_Xamarin - Fatal编程技术网

C# 删除边框导航栏按钮monotouch

C# 删除边框导航栏按钮monotouch,c#,ios,xamarin.ios,xamarin,C#,Ios,Xamarin.ios,Xamarin,因此,我正在创建一个界面,按钮上有图像,但默认情况下,苹果会在导航栏按钮周围加上边框。有没有一种简单的方法可以移除它们 据我所知,你可以 var button = new UIButton (new RectangleF (0, 0, 25, 25)); button.SetImage (new UIImage ("image"), UIControlState.Normal); NavigationItem.LeftBarButtonItem = new UIBarButtonItem (b

因此,我正在创建一个界面,按钮上有图像,但默认情况下,苹果会在导航栏按钮周围加上边框。有没有一种简单的方法可以移除它们

据我所知,你可以

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

NavigationItem.LeftBarButtonItem = new UIBarButtonItem (button);
当然,如果你想控制你的巴布托信仰,你可以这样做:

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;
据我所知,你可以

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

NavigationItem.LeftBarButtonItem = new UIBarButtonItem (button);
当然,如果你想控制你的巴布托信仰,你可以这样做:

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;

在界面生成器中,选择一个按钮,并在右侧列的属性上使用背景图像将其设置为自定义按钮:

添加普通UIButton后,您会收到一个界面生成器警报,可以使用简单的普通按钮,只需单击按钮并将其设置为自定义边框:


其他操作完成后,点击同一按钮并设置第一个屏幕

在界面生成器中选择一个按钮,并在右栏的属性上使用背景图像将其设置为自定义按钮:

添加普通UIButton后,您会收到一个界面生成器警报,可以使用简单的普通按钮,只需单击按钮并将其设置为自定义边框:



其他操作完成后,点击同一按钮并设置第一个屏幕

好的,这是可行的,但是我该如何使用SetTitleTextAttributes呢?保持一个变量指向从按钮创建的UIBarButtonItem,您可以在其上调用SetTitleExtAttributeHm我收到以下错误:参数1“无法将System.Drawing.RectangleF”表达式转换为类型“MonoTouch.UIKit.UIBarButtonSystemItem”CS1503I已完成响应,这应该可以解决您的问题。确定,这是可行的,但我如何在此上使用SetTitleExtAttributes?保留一个指向从按钮创建的UIBarButtonItem的变量,您可以在该按钮上调用SetTitleExtAttributeHm。我收到以下错误:参数1“无法将System.Drawing.RectangleF”表达式转换为类型“MonoTouch.UIKit.UIBarButtonSystemItem”CS1503I已完成响应,这应该可以解决你的问题。UIBarButton不可能做到这一点。在你的屏幕上,你不使用普通的UIBarButton,而是使用普通的UIBarButton并将其拖入导航栏,因此如果这不是真的,你可以在导航栏中使用普通的UIBarButton,像我的帖子这样的设置永远不会添加更多代码;我可以在post上添加一个屏幕来显示结果,还可以设置一个文本属性,比如一个普通的uibutton好的,我不知道你可以在导航栏上添加一个普通的uibutton!我一定会试试。@FlorianSchaal thx,我添加了一个可能出现在界面构建器上的问题。我正在更改UI以准备IOS7。这样,应用程序在IOS6和IOS7上看起来几乎相同;这在UIBarButtons中是不可能的。在您的屏幕上,您不使用普通的UIBarButton,而是使用普通的UIButton并拖动到导航栏中,因此如果这不是真的,您可以在导航栏中使用普通的UIButton,并且像我的帖子这样的设置永远不会添加更多代码;我可以在post上添加一个屏幕来显示结果,还可以设置一个文本属性,比如一个普通的uibutton好的,我不知道你可以在导航栏上添加一个普通的uibutton!我一定会试试。@FlorianSchaal thx,我添加了一个可能出现在界面构建器上的问题。我正在更改UI以准备IOS7。这样,应用程序在IOS6和IOS7上看起来几乎相同;