作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
应该如何声明 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/
我是一名优秀的程序员,十分优秀!