zoukankan      html  css  js  c++  java
  • 约束动画

    -(void)modifyConstraint:(UIButton *)btn{
        btn.translatesAutoresizingMaskIntoConstraints = NO;
        NSArray* constrains = btn.constraints;
        NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:btn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:0];
        for (NSLayoutConstraint* constraint in constrains) {
            if (constraint.firstAttribute == NSLayoutAttributeWidth) {
                [UIView animateWithDuration:1 animations:^{
                    
                    [btn addConstraint:widthConstraint];
                    [btn removeConstraint:constraint];
                    [btn layoutIfNeeded];
                } completion:^(BOOL finished) {
                   
                    dispatch_time_t timer =
                    dispatch_time(DISPATCH_TIME_NOW,
                                  0.5 *
                                  NSEC_PER_SEC);
                    dispatch_after(timer, dispatch_get_main_queue(), ^{
                        [UIView animateWithDuration:.3 animations:^{
                            [btn removeConstraint:widthConstraint];
                            [btn addConstraint:[NSLayoutConstraint constraintWithItem:btn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:40]];
                            [btn layoutIfNeeded];
                        } completion:^(BOOL finished) {
    
                        }];
                    });
                }];
                break;
            }
        }
    }
    
  • 相关阅读:
    js bubbleSort
    关于“ ,”的迷
    移位
    emacs 一些很有用的快捷键
    input&output
    async&await
    用dbforge调试procedure
    开发中常用的工具
    用Firefox的debugger来调试JavaScript
    Hibernate映射关系配置
  • 原文地址:https://www.cnblogs.com/guligei/p/9767416.html
Copyright © 2011-2022 走看看