在我的IF语句中,它有点奇怪,导致每次我的代码循环时,只有SLOT1被调用并显示在我的调试器中,为什么?我的发言有问题吗?谢谢。IF语句比较
choiceSlot1 = TRUE;
choiceSlot2 = TRUE;
choiceSlot3 = TRUE;
choiceSlot4 = TRUE;
if (slot1 != [(UIImageView*)[self.carousel1 currentItemView] tag] || twoSlot1 != [(UIImageView*)[self.carousel2 currentItemView] tag] || choiceSlot1) {
NSLog(@"Slot1");
choiceSlot1 = FALSE;
}
else if (slot2 != [(UIImageView*)[self.carousel1 currentItemView] tag] || twoSlot2 != [(UIImageView*)[self.carousel2 currentItemView] tag] || choiceSlot2) {
NSLog(@"Slot2");
choiceSlot2 = FALSE;
}
else if (slot3 != [carousel1 indexOfItemViewOrSubview:carousel1.superview] || twoSlot3 != [(UIImageView*)[self.carousel2 currentItemView] tag] || choiceSlot3) {
NSLog(@"Slot3");
choiceSlot3 = FALSE;
}
else if (slot4 != [(UIImageView*)[self.carousel1 currentItemView] tag] || twoSlot4 != [(UIImageView*)[self.carousel2 currentItemView] tag] || choiceSlot4) {
NSLog(@"Slot4");
choiceSlot4 = FALSE;
}
那么,你将choiceSlot1设置为true,所以它总是进入第一个if。 – borrrden
'choiceSlot1'始终为TRUE .. – Kjuly
我应该如何处理if语句的其余部分? – Bazinga