【发布时间】:2013-08-13 19:00:56
【问题描述】:
Phone 应用的“最近通话”视图中使用的 UIBarButtonItem 是什么?
它看起来不像我所知道的公共 API。如何创建类似的 UIBarButtonItem?
【问题讨论】:
-
@Jitesh,谢谢,这正是我所需要的。我会将我的问题标记为重复。
标签: iphone ios uibarbuttonitem
Phone 应用的“最近通话”视图中使用的 UIBarButtonItem 是什么?
它看起来不像我所知道的公共 API。如何创建类似的 UIBarButtonItem?
【问题讨论】:
标签: iphone ios uibarbuttonitem
您可以将Segment控制器添加到UIToolBar中。所以它看起来像你想要的那样。
欢呼声
【讨论】:
UISegmentedControlStyleBar。我已将我的问题标记为与另一个提供完整答案的问题重复。
它是通过类似下面的方式完成的,没有使用公共 api..
UIToolbar *toolbar=[[UIToolbar alloc] init];
[toolbar setItems:[NSArray arrayWithObjects:@"All",@"Missed", nil]];
self.navigationItem.titleView=toolbar;
【讨论】:
选项 1:
将 UISegmentedControl 添加到 UIToolBar
选项 2:(如果您使用的是导航控制器)
将 UISegmentControl 添加到 UINavigationBar
【讨论】:
你可以试试这个,
NSArray *segItemsArray = [NSArray arrayWithObjects: @"All", @"Missed", nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:segItemsArray];
UIBarButtonItem *flexibleSpace= [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
NSArray *barArray = [NSArray arrayWithObjects: flexibleSpace,segmentedControl, nil];
[toolbar setItems:barArray];
【讨论】:
toolbar.titleView 设置为segmentedControl,它应该具有UISegmentedControlStyleBar 的样式。