可可:具有用于切换标签的工具栏图标的标签视图 [英] Cocoa: Tab view with toolbar icons for switching tabs

查看:82
本文介绍了可可:具有用于切换标签的工具栏图标的标签视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各种首选项对话框(Safari,Mail,Xcode4以及使用NSPreferences的任何对话框)和Xcode4的Organizer使用的选项卡让人联想到选项卡视图-除了使用工具栏按钮在选项卡之间切换外.这些按钮被按下".

Various Preferences dialogs (Safari, Mail, Xcode4, and any that uses NSPreferences) and Xcode4's Organizer use something reminiscent of a tab view -- except that is uses toolbar buttons for switching between tabs. These buttons are "pressed".

实现这种标签视图的最佳方法是什么?是否有记录的用于实现它们的公共API?

What is the best way to implement such a tab view? Is there a documented public API for implementing them?

推荐答案

自Mac OS X 10.10(Yosemite)起,最简单的方法是使用 tabStyle

Since Mac OS X 10.10 (Yosemite), the easiest way to do this is to lay out your preferences dialog window in a storyboard using an NSTabViewController, and set its tabStyle to NSTabViewControllerTabStyleToolbar.

WWDC 2014会议212:OS X上的情节提要和控制器漫游在这种情况下,大约从10分45秒开始.

WWDC 2014 Session 212: Storyboards and Controllers on OS X walks through this scenario starting around 10m45s.

2020年1月14日更新:苹果公司以无限的智慧,显然已删除了该视频.

Update 2020-01-14: Apple, in its infinite wisdumb, has apparently removed that video.

这篇关于可可:具有用于切换标签的工具栏图标的标签视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆