UIBarButtonSystemItemPageCurl不显示,其他系统图标显示

问题描述 投票:1回答:1

我正在使用定制工具栏(UIToolBar),该工具栏将显示一些项目/按钮。但是,其中之一显示。它在那里,我可以单击它,它会响应并触发选择器,但它是不可见的。

这是我构建工具栏的方式:

spacer=    [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil] autorelease];
menuItem=  [[[UIBarButtonItem alloc] initWithImage:[JASidePanelController defaultImage] style:UIBarButtonItemStylePlain target:(TabController*)self.parentViewController action:@selector(handleShowMenu)] autorelease];
addItem=   [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:[Storage currentStorage] action:@selector(showAddDialog)] autorelease];
titleItem= [[[UIBarButtonItem alloc] initWithTitle:[self pageTitle] style:UIBarButtonItemStylePlain target:nil action:nil] autorelease];

UIBarButtonItem* mapItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(toggleMapType)] autorelease];

NSArray* items= [NSArray arrayWithObjects:menuItem, spacer, titleItem, spacer, mapItem, addItem, nil];

toolbar= [[[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 20.0, self.view.frame.size.width, TOOLBARHEIGHT)] autorelease];

[toolbar setItems:items];
[self.view addSubview:toolbar];

不会显示:

UIBarButtonItem* mapItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemPageCurl target:self action:@selector(toggleMapType)] autorelease];

“正在工作”

但是用:替换此行:

UIBarButtonItem* mapItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(toggleMapType)] autorelease];

将显示该项目。

“正在工作”

任何人都知道为什么

ios uibarbuttonitem
1个回答
1
投票

根据UIBarButtonSystemItem docs

此条形按钮图像只能用于放置在工具栏上的条形按钮项目。

您正在尝试将其放置在导航栏上,这是不允许的。

看起来像这样:

UIBarButtonSystemItem

这与iOS 7+设计指南不太吻合,因此也可能是一个问题,但是文档未提及过时的内容,因此不应该。

© www.soinside.com 2019 - 2024. All rights reserved.