gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:02:52 31 4
gpt4 key购买 nike

应该如何声明 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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com