내 while 루프가 작동하지 않는 것 같습니다. 이보기를로드하면 앱이 정지됩니다. while 루프를 포함하는 코드 부분을 삭제하면 앱이 멈추지 않습니다.while 루프가 작동하지 않는 동안
내가 찾고있는 것은 동일한 배열이 두 번 선택되지 않도록하는 코드 조각입니다.
@interface ThirdViewController()
@end
@implementation ThirdViewController
...
NSString * Answer = @"";
NSArray * RAMArray;
...
- (void)NewQuestion
{
NSString * PlistString = [[NSBundle mainBundle] pathForResource:@"Questions" ofType:@"plist"];
NSMutableArray * PlistArray = [[NSMutableArray alloc]initWithContentsOfFile:PlistString];
NSArray *PlistRandom = [PlistArray objectAtIndex: random()%[PlistArray count]];
while (![PlistRandom isEqual: RAMArray])
{
NSArray *PlistRandom = [PlistArray objectAtIndex: random()%[PlistArray count]];
}
RAMArray = PlistRandom;
...
}
- (void)Check:(NSString*)Choise
{
...
if ([Choise isEqualToString: Answer])
{
...
[self NewQuestion];
}
}
- (IBAction)AnsButA:(id)sender
{
UIButton *ResultButton = (UIButton *)sender;
NSString *Click = ResultButton.currentTitle;
[self Check:Click];
}
는 루프 –
무한 그리고 내가 그것을 어떻게 해결합니까 의미 : 내가 생각하는 당신의 문제는 범위 지정 문제가 바로 여기에 루프를 변경하고 그 작동하는지 확인입니까? – Berendschot
무한하게 만드는 것을 찾아서 –