gpt4 book ai didi

xcode4 - 如何更改 Xcode 4.5 中的默认代码缩进?

转载 作者:行者123 更新时间:2023-12-03 13:25:12 26 4
gpt4 key购买 nike

当我创建一个新的 View Controller 时,它的默认代码缩进样式看起来像

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

我可以更改任何设置,以便默认代码缩进如下所示
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

最佳答案

从菜单栏中选择 Xcode > Preferences...(默认快捷方式:comma-comma)。然后单击“文本编辑”部分。然后选择“缩进”选项卡。将“缩进宽度”设置为 2。

Xcode preferences

您可以通过在项目导航器中选择项目,然后在文件检查器的“文本设置”部分中设置“缩进”值来更改仅一个项目的缩进宽度:

enter image description here

您可以要求 Xcode 使用新的缩进宽度重新格式化现有代码,方法是选择代码并从菜单栏中选择 Editor > Structure > Re-Indent(默认快捷键:control-i)。

关于xcode4 - 如何更改 Xcode 4.5 中的默认代码缩进?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14078455/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com