您的位置:首页 > 移动开发 > IOS开发

IOS学习 autolayout 动画 与文件夹拖拽截图

2016-03-23 23:50 423 查看
@interface
ViewController ()

@property (weak,
nonatomic) IBOutlet
UIView *redView;

@property (weak,
nonatomic) IBOutlet
NSLayoutConstraint *redTop;
//绑定约束

@end

@implementation ViewController

- (void)viewDidLoad {

[super
viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent
*)event{

//只是修改约束

self.redTop.constant +=
50;

[UIView
animateWithDuration:0.5
animations:^{

//调用这个方法,可以刷新View上所有约束

[self.view
layoutIfNeeded];

}];

}





内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: