我试图找出可能在同一方法中重新定义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];
...
Run Code Online (Sandbox Code Playgroud)