应该如何声明 bArray?
NSArray *bArray;
在
- (void)viewDidLoad
[self shuffleb];
然后
-(void) shufflb
{
bArray = [NSArray arrayWithObjects:
@"ca",
@"do",
@"ba",
@"tr",
@"bu",
@"bl",
@"bo",
@"pu",
nil];
NSInteger count = [bArray count];
for (NSUInteger i = 0; i < count; ++i) {
// Select a random element between i and end of array to swap with.
NSInteger nElements = count - i;
n = (arc4random() % nElements) + i;
[bArray exchangeObjectAtIndex:i withObjectAtIndex:n];
}
最佳答案
exchangeObjectAtIndex
是 NSMutableArray 的一个方法。
关于ios - 'NSArray' 没有可见的@interface 声明选择器'exchangeObjectAtIndex :withObjectAtIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18681311/