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

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -