ios - how to determine what pan view is in what index -
ios - how to determine what pan view is in what index -
i have app 3 uiimageviews on screen. each 1 has uipangesture connected it. having problem determining pan view goes box. (see image below.) white boxes determine if pan view in them cgrectcontainspoint(). main problem getting text out of labels in image views. since different, how can know 1, 2, 3 kind of indexing pan's view in box?
here code.
if (pan.state == uigesturerecognizerstateended) { ++_countsofar; // _countsofar ivar if (cgrectcontainspoint(self.view1.frame, pan.view.center)) { pan.view.tag = 1; } else if(cgrectcontainspoint(self.view2.frame, pan.view.center)) { pan.view.tag = 2; } else pan.view.tag = 3; nslog(@"counts = %d", _countsofar); } if (_countsofar == carlevels) { nsstring *s1 = [[self.view viewwithtag:pan.view.tag].subviews[0] text]; _countsofar = 0; //reset count }
the problem code can 1 text value because subviews has 1 per view...i can't figure out. help appreciated!
here image:
you have 2 options:
set property of uiimageview , on gesture recongnizer event handler, attached uiimageview , identify relevant content based on index set.
subclass uipangesturerecognizer, add together new field called index , utilize capture gestures , index that
ios iphone objective-c
Comments
Post a Comment