Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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
Objective c 目标C:工具栏中UIBarButton缺少边框_Objective C_Uibarbuttonitem - Fatal编程技术网

Objective c 目标C:工具栏中UIBarButton缺少边框

Objective c 目标C:工具栏中UIBarButton缺少边框,objective-c,uibarbuttonitem,Objective C,Uibarbuttonitem,我试图创建一个UIBarButton,并使用代码将其添加到工具栏中。运行应用程序后,我发现我的按钮边框丢失。我的代码如下所示 //Add toolbar to the UITable View toolbar = [[UIToolbar alloc] init]; toolbar.barStyle = UIBarStyleDefault; toolbar.frame = CGRectMake(0, 436, 320, 50); //Set the toolbar to fit the widt

我试图创建一个UIBarButton,并使用代码将其添加到工具栏中。运行应用程序后,我发现我的按钮边框丢失。我的代码如下所示

//Add toolbar to the UITable View
toolbar = [[UIToolbar alloc] init];
toolbar.barStyle = UIBarStyleDefault;
toolbar.frame = CGRectMake(0, 436, 320, 50);

//Set the toolbar to fit the width of the app.
[toolbar sizeToFit];

UIBarButtonItem *flexButton =[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
                                                                           target:nil 
                                                                           action:nil];

UIBarButtonItem *nextButton = [[UIBarButtonItem alloc]initWithTitle:@"Who Paid?" 
                                                              style:UIBarButtonItemStylePlain 
                                                             target:self
                                                             action:nil];

NSArray *buttonItems = [[NSArray alloc]initWithObjects:flexButton, nextButton, nil];

[self.toolbar setItems:buttonItems];

[self.navigationController.view addSubview:toolbar];


[buttonItems release];
[flexButton release];
[nextButton release];
[toolbar release];

我是否错过了任何一步,或者是否犯了错误?在此方面的任何帮助都将不胜感激

谢谢


珍是罪魁祸首

根据,
UIBarButtonimStyleBordered
是您所需要的:


uiBarButtonimStyleplain
:当 轻敲。默认项样式

UIBarButtonimStyleBorded
:一个简单的 带边框的按钮样式

uibarbuttonimstyledone
:的样式 完成按钮,例如,按钮 这就完成了一些任务并返回 转到上一个视图


您尝试过按钮的
uibarbuttonimstyleplain
以外的样式吗?是的,谢谢!我找到了一个有边框的。非常感谢!我找到了另一个,上面写着带边框的。我真傻。