ios Xcode 4 的隐藏功能

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5410191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:20:39  来源:igfitidea点击:

Hidden Features of Xcode 4

cocoaiosmacosxcode4hidden-features

提问by schwa

Now that Xcode 4 is officially released it's time for a follow up to my previous question: Hidden Features of Xcode

现在 Xcode 4 正式发布了,是时候跟进我之前的问题了:Xcode 的隐藏功能

So what are they? What are those hidden little Xcode 4 hints & tips that you can't live without?

那么它们是什么?哪些隐藏的小 Xcode 4 提示和技巧是您离不开的?

Please limit your tips to those that are new and specific to Xcode 4!

请将您的提示限制在那些新的和特定于 Xcode 4 的提示上!

回答by memmons

If you like your code to look as good as it runs, you've undoubtedly used #pragma mark -and #pragma mark <name>to provide a nice visual grouping in the Xcode class dropdown list. Xcode 4 now combines these into a single #pragma mark - <name>.

如果您希望您的代码看起来和运行时一样好,那么您无疑已经使用#pragma mark -#pragma mark <name>在 Xcode 类下拉列表中提供了一个很好的可视化分组。Xcode 4 现在将这些组合成一个单一的#pragma mark - <name>.

More on pragma mark.

更多关于 pragma 标记

Xcode pragma mark

Xcode 编译指示标记

回答by bbum

  • shift-cmd-optclick on a symbol lets you tell Xcode exactlywhere in the UI you want the navigated-to file to open.

  • cmd-retmakes the version editor / assistant (the right hand pane) go away

  • shift-cmd-Yto hide the debugger

  • cmd-0to hide the navigator (left pane)

  • cmd-[1..n]switch between navigators on left

  • cmd-opt-[1..n]switch between utilities (thing generally on right)

  • ctrl-[1..n]switch between various related files in the editor

  • shift- cmd-opt点击一个符号,您可以告诉Xcode的正是其中的UI你想要的导航的文件打开。

  • cmd-ret使版本编辑器/助手(右侧窗格)消失

  • shift- cmd-Y隐藏调试器

  • cmd-0隐藏导航器(左窗格)

  • cmd-[1..n]在左侧导航器之间切换

  • cmd- opt-[1..n]在实用程序之间切换(通常在右边)

  • ctrl-[1..n]在编辑器中的各种相关文件之间切换

Overall, Xcode 4 tries to keep things consistent w/the hot keys. Cmd is for mainline commands. Adding modifiers is for analogous commands focused on one particular sub-feature.

总的来说,Xcode 4 试图通过热键保持一致。Cmd 用于主线命令。添加修饰符适用于专注于一个特定子功能的类似命令。

(These are just the four that come to mind as the my most pounded upon shortcuts that I'm using constantly! I'm sure it'll change over time as my workflow is refactored into the new hotness.)

(这四个只是我经常使用的最常用的快捷方式!我相信随着我的工作流程被重构为新的热点,它会随着时间的推移而改变。)

回答by Brian Webster

Xcode 4 adds a new "Code Snippets" feature, accessible via View > Utilities > Code Snippet Library. To add a new code snippet, select some text in the editor view and drag it into the snippet library. You can either drag a snippet out and drop it in your code to use it, or, much more conveniently, assign a completion shortcut to it.

Xcode 4 添加了一个新的“代码片段”功能,可通过查看 > 实用工具 > 代码片段库访问。要添加新的代码片段,请在编辑器视图中选择一些文本并将其拖到片段库中。您可以将代码段拖出并放入代码中以使用它,或者更方便的是,为其指定一个完成快捷方式。

When you type in that series of letters, it will automatically show up in the code completion pop-up menu as you type your code. For example, among many others, I have a snippet set up so that typing "svk" will expand to setValue:<#value#> forKey:<#key#>. This can save a lot of typing and/or fishing around in the autocompletion menu for the methods and other code expressions you use the most. Xcode ships with a bunch of built-in snippets that come in very handy as well.

当您输入这一系列字母时,它会在您输入代码时自动显示在代码完成弹出菜单中。例如,在许多其他人中,我设置了一个片段,以便键入“svk”将扩展为setValue:<#value#> forKey:<#key#>. 这可以在自动完成菜单中为您最常用的方法和其他代码表达式节省大量键入和/或钓鱼的时间。Xcode 附带了一堆内置的片段,它们也非常方便。

回答by wdn

New shortcut I use most often: triple-finger swipe (up or down) to swap counterparts (between the interface and implementation files). No more hand acrobatics!

我最常使用的新快捷方式:三指轻扫(向上或向下)以交换对应项(在接口和实现文件之间)。没有更多的手部杂技!

Thanks to https://twitter.com/xctotd/status/48148271759241216

感谢https://twitter.com/xctotd/status/48148271759241216

回答by Peter Hosey

shift-option-click on a file in the Groups and Files listProject Navigator, or hold shift-optionwhile choosing a file from the Jump Bar.

shift--option点击文件中的组和文件列表项目导航器,或按住shift-option从跳转栏中选择文件时。

You'll get a pop-over from which to pick where to open the file.New or existing tab, new or existing split (Assistant) editor, new window—every possible option is there.

您将获得一个弹出窗口,从中可以选择打开文件的位置。新的或现有的选项卡、新的或现有的拆分(助手)编辑器、新窗口——所有可能的选项都在那里。

回答by Peter Hosey

Tabs in Xcode 4 are awesome. Each one maintains its own separate layout, so you can have multiple tabs with different things in them and have each one lain out appropriately.

Xcode 4 中的选项卡很棒。每个都有自己独立的布局,因此您可以拥有多个包含不同内容的选项卡,并且每个选项卡都适当地排列。

I've been setting up my projects with three layouts—one for the project object, one for each nib (showing the owner's class's sources), and one for each class.

我一直在用三种布局设置我的项目——一种用于项目对象,一种用于每个笔尖(显示所有者的类的源),一种用于每个类

There is one bug here: As of 4.0, Xcode will reset the state (turning off any Assistants) of the active tab when you reopen the project. The workaround is to switch to a tab with no Assistants for Xcode to close before you close the project. I have filed this as Radar number 9178441.

这里有一个错误:从 4.0 开始,当您重新打开项目时,Xcode 将重置活动选项卡的状态(关闭任何助手)。解决方法是在关闭项目之前切换到没有 Xcode 助手的选项卡来关闭。我已将此作为雷达编号 9178441 提交。

回答by Cris

  • ctrl-6pops down within-file segment of jump bar (enables keyboard-controlled jump to methods)

  • cmd-{/}select previous / next tab

  • cmd-Jnavigate to any editor (but why oh why doesn't TAB then cycle between them?)

  • ctrl-6弹出跳转栏的文件内段(启用键盘控制跳转到方法)

  • cmd- {/}选择上一个/下一个标签

  • cmd-J导航到任何编辑器(但为什么哦,为什么 TAB 然后不在它们之间循环?)

回答by Sagar R. Kothari

Editor ShortCuts

编辑器快捷键

  • Cmd+ Ctrl+ up/downJump between .h & .m Files.
  • Cmd+ Ctrl+ Left/RightJump between Previous Edited Files/Next Edited files.
  • Cmd+ Ctrl+up/down在 .h 和 .m 文件之间跳转。
  • Cmd+ Ctrl+Left/Right在上一个编辑过的文件/下一个编辑过的文件之间跳转。

Layout Shortcuts

布局快捷方式

  • Cmd+ 0hide or show navigators
  • Cmd+ opt+ 0hide or show inspectors
  • Cmd+ Shift+ Yhide or show debugger console.
  • Cmd+0隐藏或显示导航器
  • Cmd+ opt+0隐藏或显示检查员
  • Cmd+ Shift+Y隐藏或显示调试器控制台。

Navigators Shortcuts

导航器快捷方式

  • Cmd+ 1Project
  • Cmd+ 2Symbol
  • Cmd+ 3Search
  • Cmd+ 4Issue
  • Cmd+ 5Debug
  • Cmd+ 6BreakPoint
  • Cmd+ 7Log
  • Cmd+1项目
  • Cmd+2符号
  • Cmd+3搜索
  • Cmd+4问题
  • Cmd+5调试
  • Cmd+6断点
  • Cmd+7日志

Tab Switching & Jumping

标签切换和跳转

  • Cmd+ {Previous Tab
  • Cmd+ }Next Tab
  • Cmd+ jSelect location to jump
  • Shift+ Option+ ClickFileSelect location to open file
  • Cmd+ Alt+ Option+ ClickSelect location to open Method
  • Cmd+{上一个标签
  • Cmd+}下一个标签
  • Cmd+j选择位置跳跃
  • Shift+ Option+ClickFile选择打开文件的位置
  • Cmd+ Alt+ Option+Click选择位置打开方法

Inspectors

检查员

  • Cmd+ Opt+ 1File Inspector
  • Cmd+ Opt+ 2Quick Help
  • Cmd+ Opt+ 3Identity Inspector
  • Cmd+ Opt+ 4Attribute Inspector
  • Cmd+ Opt+ 5Size inspector
  • Cmd+ Opt+ 6Connection Inspector
  • Cmd+ Opt+1文件检查器
  • Cmd+ Opt+2快速帮助
  • Cmd+ Opt+3身份检查员
  • Cmd+ Opt+4属性检查器
  • Cmd+ Opt+5尺寸检查员
  • Cmd+ Opt+6连接检查器

Build Related

构建相关

  • Cmd+ BBuild
  • Cmd+ Shift+ KClean
  • Cmd+ .top
  • Cmd+B构建
  • Cmd+ Shift+K清洁
  • Cmd+.顶部

Code Folding

代码折叠

  • Cmd+ Alt+ LeftMinimize Current Method/Class/Interface
  • Cmd+ Alt+ RightExpand Current Method/Class/Interface
  • Cmd+ Alt+ Shift+ LeftMinimize All Method/Class/Interface
  • Cmd+ Alt+ Shift+ RightExpand All Method/Class/Interface
  • Cmd+ Alt+Left最小化当前方法/类/接口
  • Cmd+ Alt+Right展开当前方法/类/接口
  • Cmd+ Alt+ Shift+Left最小化所有方法/类/接口
  • Cmd+ Alt+ Shift+Right展开所有方法/类/接口

回答by aitskovi

Some useful hotkeys for working on smaller screens are:

在小屏幕上工作的一些有用的热键是:

  • cmd-shift-y- Hide and show the console/debug area

  • cmd-0- Hide and show the file navigation

  • cmd- shift- y- 隐藏和显示控制台/调试区域

  • cmd- 0- 隐藏和显示文件导航

回答by Brian Webster

If you're having any sort of trouble with the indexing of your project (e.g. symbols not showing up in autocompletion), open the Organizer window, click the Projects tab, and use the "Delete" button to delete the derived data for your project. This will force a rebuild of the project's index, as well as tossing out any built products.

如果您在索引项目时遇到任何问题(例如符号未在自动完成中显示),请打开管理器窗口,单击项目选项卡,然后使用“删除”按钮删除项目的派生数据. 这将强制重建项目的索引,并丢弃任何构建的产品。