如何使NSToolbar中的控制器随NSSplitViewController的视图(如Reeder或Mail.app)一起移动 [英] How to make controller in NSToolbar moving with NSSplitViewController's view like Reeder or Mail.app

查看:128
本文介绍了如何使NSToolbar中的控制器随NSSplitViewController的视图(如Reeder或Mail.app)一起移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发可可应用.它包含一个带有一些功能按钮的工具栏.就像里德(Reeder)一样.

I am developing a cocoa application. It contains a toolbar having some feature buttons. Just like Reeder.

我想在调整拆分视图大小的同时调整工具栏部分的大小.如下所示.如何实现这种功能?

I want to resize the toolbar section while resizing the split view. Something works like below. How to implement this kind of feature?

任何可以帮助我或提出建议的人都会感激不尽.

Any one can help me or give some suggestions will be appreciated.

我正在使用XCode7,Swift和Storyboard进行开发.

I am developing with XCode7, Swift and Storyboard.

推荐答案

很显然,没有任何方法可以将splitView添加到工具栏本身,而且我怀疑我们在reeder中看到的不是标准的工具栏.无论如何要做到这一点,我都做了以下

Obviously there isn't any way to add a splitView to the toolbar itself and i suspect what we see in reeder is not a standard toolbar. In anycase to get this, i did the following

  1. 隐藏的标题栏,透明的工具栏和主控制器上的全屏视图

  1. 将高度为38的自定义视图添加到您的SplitViewController splitView项的源列表(边栏),内容列表(索引列表)和默认区域"的顶部.然后向此splitView添加按钮

  1. 这是主窗口上的样子

  1. 如果要获得完整的工具栏外观.为所有customView创建一个高度为37点的出口(向其添加按钮的出口),并自定义背景,添加渐变和底部边框
  1. If you want to get the complete toolbar look. create an outlet to all your customView with the 37 point height (the ones to which you added the buttons) and customize the background, adding a gradient and a bottom border

这篇关于如何使NSToolbar中的控制器随NSSplitViewController的视图(如Reeder或Mail.app)一起移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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