简体   繁体   中英

Resizing weirdness in custom View with isFlipped YES

I'm having a hard time getting my subview to behave properly.

I am using auto-layout. My main window is an NSSplitView . One of the views in the split view is a custom view, where I set

-(BOOL)isFlipped
{
    return YES;
}

An added subview in this view is displayed at the top left. The subview is a lot smaller than the superview, so there is some space left over at the bottom. The problems start when I resize the window (and thus the superview). The subview moves up, out of view, like below. First picture shows the top of the subview nicely aligned at the top of the superview:

在此处输入图片说明

After resizing the window, I get this at the top:

在此处输入图片说明

This should not happen; if anything, the subview should be clipped at the bottom. The top-left of the subview should always stay at the top-left of the superview.

I am sure I made an error somewhere -- does someone recognize this behavior? I am afraid I messed things up a while ago and have no idea where to look. Any help appreciated!

Problem solved after turning "translates mask into constraints" off for the subview: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM