Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use the code below to dump the superviews and the subviews of self.view before you rotate, then after the rotation is done, then again when the rotation back to portrait is done. One of the views will not match its original origin, and that will be your problem view. The change in origin may well be due to the struts not being enabled on the top/left.</p> <p>This happened to me so many times I wrote this UIView category to dump super and subviews. </p> <p>Usage:</p> <pre><code>[UIView dumpSuperviews:self.view msg:@"Original superviews"]; [UIView dumpSubviews:self.view msg:@"Original subviews"]; </code></pre> <p>Code:</p> <pre><code>#import &lt;QuartzCore/QuartzCore.h&gt; #import "UIView+Utilities.h" @interface UIView (Utilities_Private) + (void)appendView:(UIView *)v toStr:(NSMutableString *)str; @end @implementation UIView (Utilities_Private) + (void)appendView:(UIView *)a toStr:(NSMutableString *)str { [str appendFormat:@" %@: frame=%@ bounds=%@ layerFrame=%@ tag=%d userInteraction=%d alpha=%f hidden=%d\n", NSStringFromClass([a class]), NSStringFromCGRect(a.frame), NSStringFromCGRect(a.bounds), NSStringFromCGRect(a.layer.frame), a.tag, a.userInteractionEnabled, a.alpha, a.isHidden ]; } @end @implementation UIView (Utilities) + (void)dumpSuperviews:(UIView *)v msg:(NSString *)msg { NSMutableString *str = [NSMutableString stringWithCapacity:256]; while(v) { [self appendView:v toStr:str]; v = v.superview; } [str appendString:@"\n"]; NSLog(@"%@:\n%@", msg, str); } + (void)dumpSubviews:(UIView *)v msg:(NSString *)msg { NSMutableString *str = [NSMutableString stringWithCapacity:256]; if(v) [self appendView:v toStr:str]; for(UIView *a in v.subviews) { [self appendView:a toStr:str]; } [str appendString:@"\n"]; NSLog(@"%@:\n%@", msg, str); } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload