我有一个随机生成的数组,我将该内容存储到 Nsmutablearray 中。
我的内容像这样 1 2 3 4 5 6 7 8
我的要求是,当用户删除第 3 个数字并单击下一步按钮时,将显示第 4 个索引数据这是我的场景,我该怎么做...
我试过这段代码
NSLog(@"%u",[delegate.Bookmarknamearray count]-1);
NSLog(@"%d",delegate.selectId);
if([delegate.Bookmarknamearray count]-1==delegate.selectId)
{
if(([delegate.Bookmarknamearray count]-1)==0)
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
else
{
NSLog(@"%u",[delegate.Bookmarknamearray count]-1);
NSLog(@"%d",delegate.selectId);
txttrickname.text=[delegate.Bookmarknamearray objectAtIndex:delegate.selectId-1];
txtview.text=[delegate.BookmarkDetailarray objectAtIndex:delegate.selectId-1];
NSLog(@"%@",txttrickname.text);
NSLog(@"%@",txtview.text);
[delegate.Bookmarknamearray removeObject:delegate.str];
self.navigationItem.title = [NSString stringWithFormat:@"%d/%d", (delegate.selectId), [delegate.Bookmarknamearray count]];
NSLog(@"%@",self.navigationItem.title);
}
}
else
{
if([delegate.Bookmarknamearray count]==1)
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
else
{
NSLog(@"%lu",(unsigned long)[delegate.Bookmarknamearray count]);
NSLog(@"%d",delegate.selectId);
NSLog(@"%d",delegate.counter);
txttrickname.text=[delegate.Bookmarknamearray objectAtIndex:delegate.selectId+1];
txtview.text=[delegate.BookmarkDetailarray objectAtIndex:delegate.selectId+1];
NSLog(@"%@",txttrickname.text);
NSLog(@"%@",txtview.text);
[delegate.Bookmarknamearray removeObject:delegate.str];
self.navigationItem.title = [NSString stringWithFormat:@"%d/%d", (delegate.selectId+1), [delegate.Bookmarknamearray count]];
NSLog(@"%@",self.navigationItem.title);
}
}
}
提前致谢..