objective c - Popover resigning first responder for touch events to view controller that called the popover -


i have popover should disappear when user touches uiimageview in it. create uiimageview user drags original viewcontroller. i'm pretty sure has first responder. how make touchesbegan, touchesmoved, , touchesended directly called original viewcontroller?

this have far:

initializing popover:

popovercreatenewboardviewcontroller *content = [popovercreatenewboardviewcontroller new];     content.delegate = self;     showpiecespopover = [[uipopovercontroller alloc] initwithcontentviewcontroller:content];     showpiecespopover.popovercontentsize = cgsizemake(150.0, 500.0);     showpiecespopover.delegate = self; 

popover.m

-(void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     uitouch *objecttouched = [touches anyobject];     if ([objecttouched.view iskindofclass:[uiimageview class]]) {         uiimageview *imageviewtouched = (uiimageview*)objecttouched.view;         [delegate pieceselectedtype:imageviewtouched.tag color:piecescolor];         [self resignfirstresponder];         [delegate touchesbegan:touches withevent:event];     } }  -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event {     [delegate touchesmoved:touches withevent:event]; } 

viewcontroller.m

-(void)pieceselectedtype:(nsinteger)piecetype color:(nsinteger)piececolor {     selectedpieceimageview.image = [self imageofpiecetype:piecetype color:piececolor];     movingpiece = yes;     [showpiecespopover dismisspopoveranimated:yes]; }  -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event {     if (movingpiece) {         cgpoint touchpoint = [[touches anyobject] locationinview:self.view];         [selectedpieceimageview setcenter:touchpoint];     } } 

using code, touchesmoved stops being called after second after popover starts being dismissed.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -