修复 Xcode 中的代码缩进 [英] Fix code indentation in Xcode

查看:30
本文介绍了修复 Xcode 中的代码缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我开始编辑我的代码并添加 for 循环或 if then 语句,我的代码缩进就会被破坏,因为以前的代码保持其以前的缩进而不是自动调整.

Once I start editing my code and adding for loops or if then statements my code indentation is whacked because the previous code maintains its former indentation instead of adjusting automatically.

在 Visual Studio 中,您可以突出显示代码并选择格式选择"来解决这些问题 - Xcode 中是否有类似的东西?

In Visual Studio you can highlight code and select 'format selection' to fix these issues - is there anything similar in Xcode?

推荐答案

在 Xcode 9 之前(对于 Xcode 9,请参见下面的默认快捷方式)

Before Xcode 9 (for Xcode 9 see default shortcut below)

  1. 选择文本
  2. 右击
  3. 弹出菜单中有一个重新缩进选择"项

<小时>

在 XCode 4 中还有一个步骤:


In XCode 4 there is one more step:

  1. 选择文本
  2. 右击
  3. 点击结构"
  4. 弹出菜单中有重新缩进选择"和其他选项

<小时>

或者使用默认快捷方式:


Or using the default shortcut:

  1. 选择文本
  2. ctrl + i

这篇关于修复 Xcode 中的代码缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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