ios - Tap outside UICollectionViewCell -
i have uicollectionview
series of uicollectionviewcell
s in uicollectionviewflowlayout
.
each cell contains uiimageview
that, depending on indexpath bigger cell itself. cell doesn't clip content, can see whole image.
but can't make touches outside cell's frame, inside image, act normal touches , fire selection of cell.
i tried overriding methods hittest:withevent
, pointinside:withevent
of uicollectionviewcell
makes no change.
- (uiview *)hittest:(cgpoint)point withevent:(uievent *)event { if (cgrectcontainspoint(self.imageview.frame, point)) { nslog(@"contains: %d", cellindex); return self; } nslog(@"doesn't contain: %d", cellindex); return [super hittest:point withevent:event]; } - (bool)pointinside:(cgpoint)point withevent:(uievent *)event { if (cgrectcontainspoint(self.imageview.frame, point)) { nslog(@"inside: %d", cellindex); return yes; } nslog(@"outside: %d", cellindex); return no; }
when have first 3 elements of collection view on screen , go , tap on third 1 (outside it's cell's frame, inside uiimageview) traces:
2013-05-06 10:53:38.395 contigo[3351:c07] doesn't contain: 0 2013-05-06 10:53:38.395 contigo[3351:c07] outside: 0 2013-05-06 10:53:38.396 contigo[3351:c07] contains: 2 2013-05-06 10:53:38.396 contigo[3351:c07] doesn't contain: 0 2013-05-06 10:53:38.396 contigo[3351:c07] outside: 0 2013-05-06 10:53:38.396 contigo[3351:c07] contains: 2 2013-05-06 10:53:38.396 contigo[3351:c07] doesn't contain: 0 2013-05-06 10:53:38.396 contigo[3351:c07] outside: 0 2013-05-06 10:53:38.397 contigo[3351:c07] contains: 2