求 oc goto语句的正确姿势,现在goto 的调用在条件以内,但是实际情况是条件没满足也调用了,什么情况?谢谢
高洛峰2017-04-18 09:42:15
Follow the normal program execution sequence, after self.collectionView.alpha = 1, continue to execute the following code. goto just helps you jump to this sentence in advance, it does not mean that when the normal sequence execution reaches this point, the execution of the code included in this goto will be skipped.
It can be roughly understood that if there is no break in the switch, the following code will continue to be executed.
If it were me, I would write it as
if(pangestureRecongnizer.state == UIGestureRecognizerStateEnded && offsetY<=70 && offsetY >= -70 ){
self.collectionView.alpha = 1;
}else{
collectionViewHidden
}