0

我试图找出可能在同一方法中重新定义 NSString 的最佳方法。基本上在过去我已经处理过它们[self goSomewhereVoid]以重新定义字符串然后返回到该方法。有没有其他方法可以在不离开方法的情况下做到这一点?谢谢你。

- (void)someMethod(NSString *)theString {

isNumberOne = YES;

NSString *theString = @"something that changes often";
[self goSomewhereVoid:theString];

isNumberTwo = YES;

NSString *theString = @"time to change something"; // <- possible to redefine this?
[self goSomewhereElseVoid:theString];

...
4

1 回答 1

5

是的,去吧:

theString = @"new value";
于 2012-06-10T00:45:08.267 回答