是否可以在 UISegmentedControl 之外添加 UIBarButtonItem?
Is it possible to add a UIBarButtonItem besides a UISegmentedControl?
我已将 UISegmentedControl 添加到 UINavigation Bar,当我尝试使用以下代码在 viewDidLoad viewController 中以编程方式添加 UIBarButtonItem 时:
UIBarButtonItem *timeTableBarButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"blueRoundRect"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(popUpTimeTable)];
self.navigationItem.rightBarButtonItem = timeTableBarButton;
根本没有显示任何按钮。我想知道既然我已经有一个 UISegmentedControl,是否可以这样做?
可以在导航栏中添加栏按钮,您的段控件不可能阻止右侧栏按钮项目。请确保您的 self.navigationItem 不为零。
我已将 UISegmentedControl 添加到 UINavigation Bar,当我尝试使用以下代码在 viewDidLoad viewController 中以编程方式添加 UIBarButtonItem 时:
UIBarButtonItem *timeTableBarButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"blueRoundRect"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(popUpTimeTable)];
self.navigationItem.rightBarButtonItem = timeTableBarButton;
根本没有显示任何按钮。我想知道既然我已经有一个 UISegmentedControl,是否可以这样做?
可以在导航栏中添加栏按钮,您的段控件不可能阻止右侧栏按钮项目。请确保您的 self.navigationItem 不为零。