ios - How to detect touch on UICollectionView? -
i want disable uicollectionviewcontroller's autorotation whenever there's finger on screen, iphone photo app does.
how that?
- if use tap gesture, how distinguish different touch states? (the state should
touching, after finger moving.) - if use
touchbegan:withevent:, put code? (the hit view can subview of uicollectionview.)
i set flag in touchesbegan , clear in touchesended. in shouldautorotate method can check flag , return false if flag set.
something this:
// in uicollectionview subclass: -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { // stuff ... canrotate = no; } -(void)touchesended:(nsset *)touches withevent:(uievent *)event { // stuff ... canrotate = yes; } // in uicollectionviewcontroller: -(bool)shouldautorotate { return(canrotate); }
Comments
Post a Comment