ios - Why a subView won't stay in the parent frame? -
i have view , inside there's uiimage . image isn't static , can move around if drag finger around (using drag events) problem picture moves outside of uiview frame. what's appropriate way keep inside parent frame bounds? --uiviewa --------uiviewb --------------uiimage --------------uibutton i want keep uiimage inside uiviewb - (ibaction)mybuttonsingletap:(uibutton *)sender { imdragging = yes; [_mybutton addtarget:self action:@selector(dragbegan:withevent:) forcontrolevents: uicontroleventtouchdown]; } - (ibaction)mybuttondraginside:(uibutton *)sender { [_mybutton addtarget:self action:@selector(draging:withevent:) forcontrolevents: uicontroleventtouchdraginside]; } - (void)dragbegan:(uicontrol *)c withevent:ev { uitouch *touch = [[ev alltouches] anyobject]; startingtouchpoint = [touch locationinview:self.view]; } - (void)draging:(uicontrol *)c withevent:ev { uitouch *touch = [[ev alltouches] anyobject]; currenttouchpoint = [...