ios - 'NSArray' 没有可见的@interface 声明选择器'exchangeObjectAtIndex :withObjectAtIndex

标签 ios objective-c nsarray

应该如何声明 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];
}

最佳答案

关于ios - 'NSArray' 没有可见的@interface 声明选择器'exchangeObjectAtIndex :withObjectAtIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18681311/

相关文章:

ios - session.dataTask 是异步的吗?

objective-c - 如何同时保存 NSDocument?

objective-c - 未找到运行 XC 4.4.1 的 FacebookSDK Mountain Lion 框架

ios - 当我在 block 中返回 NSOrderedSame 时,sortedArrayUsingComparator 方法如何做?

objective-c - 我如何扩展 NSArray?

ios - 如何制作一个包含 3 个对象的数组?

ios - Flutter 登录苹果失败

ios - 使用 Moment Tz 格式化日期

ios - 如何在 swift 中正确添加 http header "Connection :close"?

java - AES256加密 objective-c 实现