Pause XCode debugger when subview is added
I have a problem in开发者_C百科 my code. I can't find what adds UIImageView to my UIScrollView. There is no direst addSubview call for sure. Is there any way to make conditional breakpoint or watchpoint to stop execution when subview is added? I tried to add scrollView.subviews to the watchpoint list but XCode doesn't stop execution when subviews are added.
Thanks!
Your probably adding it in your nib. Try subclassing an UIImageView, override its didMoveToSuperview as follows:
- (void)didMoveToSuperview {
[super didMoveToSuperview];
}
Put a breakpoint in there.
Use your subclass instead of UIImageView class when instantiating the view.
You can do a similar thing with your scrollView; subclass, override its addSubview: method and put a breakpoint in there.
Hope this helps
精彩评论