How to get the frame of a view inside another view?
问题 I have an UIImageView in the self.view (the main View) and inside it there is a UIButton . I want to know what's the frame of UIButton in self.view not in UIImageView . 回答1: I guess you are looking for this method – convertRect:toView: // Swift let frame = imageView.convert(button.frame, to: self.view) // Objective-C CGRect frame = [imageView convertRect:button.frame toView:self.view]; 回答2: There are four UIView methods which can help you, converting CGPoints and CGRects from one UIView