使用Xcode编写Objective-C时如何逃离括号?

时间:2022-09-07 07:49:50

I find writing Objective-C with Xcode sometimes could be painful when trying to escape from the bracket,

我发现用Xcode编写Objective-C有时在试图逃离支架时会很痛苦,

like I have to use the mouse or the direction key Right to continue after entering [UIView alloc].

就像我必须使用鼠标或方向键Right进入[UIView alloc]后继续。

Is there another way? Tab is not working :(

还有另一种方式吗?标签不起作用:(

使用Xcode编写Objective-C时如何逃离括号?

2 个解决方案

#1


1  

I assume Xcode is inserting the close bracket (]) for you, after your cursor. That happens because you have “Enable type-over completions” turned on in Xcode's preferences:

我假设Xcode在你的光标之后为你插入了close括号(])。这是因为您在Xcode的首选项中启用了“启用类型转换完成”:

使用Xcode编写Objective-C时如何逃离括号?

One way to handle this is by typing a close bracket when your cursor is at the close bracket. Because “Enable type-over completions” is turned on, Xcode will not insert another close bracket. It will just move the cursor past the existing close bracket. Try it! When you want to “escape from the bracket”, just type the bracket.

解决此问题的一种方法是在光标位于近距离时键入一个右括号。由于“启用类型转换完成”已打开,因此Xcode不会插入另一个关闭括号。它只会将光标移过现有的近括号。尝试一下!如果要“从支架中退出”,只需键入支架即可。

Another way to handle this is by turning off the “Enable type-over completions” setting. If you turn it off, Xcode will not insert the close bracket for you, so you'll have to type the close bracket, but you won't have to “escape from the bracket” because there's no bracket to escape from.

处理此问题的另一种方法是关闭“启用类型完成”设置。如果你关闭它,Xcode将不会为你插入关闭支架,所以你必须键入关闭支架,但你不必“从支架中逃脱”,因为没有支架可以逃脱。

#2


0  

No way around this as the autocomplete feature puts the cursor behind the close bracket to continue typing the method call. If this feature is turned off you can just type the closed bracket to finish the method call.

由于自动完成功能将光标置于关闭括号后面以继续键入方法调用,因此无法解决此问题。如果关闭此功能,您只需键入闭括号即可完成方法调用。

#1


1  

I assume Xcode is inserting the close bracket (]) for you, after your cursor. That happens because you have “Enable type-over completions” turned on in Xcode's preferences:

我假设Xcode在你的光标之后为你插入了close括号(])。这是因为您在Xcode的首选项中启用了“启用类型转换完成”:

使用Xcode编写Objective-C时如何逃离括号?

One way to handle this is by typing a close bracket when your cursor is at the close bracket. Because “Enable type-over completions” is turned on, Xcode will not insert another close bracket. It will just move the cursor past the existing close bracket. Try it! When you want to “escape from the bracket”, just type the bracket.

解决此问题的一种方法是在光标位于近距离时键入一个右括号。由于“启用类型转换完成”已打开,因此Xcode不会插入另一个关闭括号。它只会将光标移过现有的近括号。尝试一下!如果要“从支架中退出”,只需键入支架即可。

Another way to handle this is by turning off the “Enable type-over completions” setting. If you turn it off, Xcode will not insert the close bracket for you, so you'll have to type the close bracket, but you won't have to “escape from the bracket” because there's no bracket to escape from.

处理此问题的另一种方法是关闭“启用类型完成”设置。如果你关闭它,Xcode将不会为你插入关闭支架,所以你必须键入关闭支架,但你不必“从支架中逃脱”,因为没有支架可以逃脱。

#2


0  

No way around this as the autocomplete feature puts the cursor behind the close bracket to continue typing the method call. If this feature is turned off you can just type the closed bracket to finish the method call.

由于自动完成功能将光标置于关闭括号后面以继续键入方法调用,因此无法解决此问题。如果关闭此功能,您只需键入闭括号即可完成方法调用。