简体   繁体   中英

Autolayout expand label when press button

I'm developing iOS 6 application and using Autolayout. My interface is very simple: label and button verticale aligned. Label has very long text but it's height is set to 50. I want to expand the label when the button is pressed. I try to make it but when the label is expanded the button is not moved. I want vertical space between them to be constant. My button action code look like this:

- (IBAction)touch:(id)sender {
    [self.label sizeToFit];
}

You can connect UI Elements via interface builder.

Check out this tutorial

http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2

Cheers.

I found the problem. I should set height of the length to be greater than or equal not equal

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