开发者

Objective-C: NSMutableString error

I keep getting an error with this code, the app is telling me I am trying to mutate an object which is not mutable. Can someone take a look and explain what I am doing wrong? Thanks.

thisrow = [NSString stringWithFormat:@"%i", startPointX2];
NSMutableString* setCoordStr = [[NSMutableString alloc] init];
[setCoordStr appendFormat: thisrow];

if(w==1) {
    thiscol =  [NSString stringWithFormat:@"%i", endPointY];
    [setCoordStr insertString:thiscol atIndex:[setCoordStr length]];
 } else {
    for(startPointY; startPointY<endPointY+1; startPointY++) 开发者_开发问答{
        thiscol =  [NSString stringWithFormat:@"%i", startPointY];
        [setCoordStr insertString:thiscol atIndex:[setCoordStr length]];
    }
 }

NSLog(@"%@ ", setCoordStr);


You could used appendString: instead of your first appendFormat:and your insertString:atIndex:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜