首页 > 代码库 > ios中使view向左移动,且右边不动
ios中使view向左移动,且右边不动
ios中使view向左移动,且右边不动
by 伍雪颖
-(void)signUpAndLoginAnimation:(BOOL)showSignUp { CGFloat LogInWidthChange = (showSignUp)?-120:120; [UIView animateWithDuration:0.3f animations:^{ CGRect newFrame = self.logInView2.frame; newFrame.origin.x -= LogInWidthChange; newFrame.size.width += LogInWidthChange; CGFloat newSizeX = self.logInView2.frame.size.width + LogInWidthChange; CGFloat ofsetX = LogInWidthChange; [self.logInView2 setFrame:CGRectMake(self.logInView2.frame.origin.x-ofsetX, self.logInView2.frame.origin.y, newSizeX, self.logInView2.frame.size.height)]; }]; }
发现写复杂了:
[UIView animateWithDuration:0.3f animations:^{ CGFloat changeWidth = (showSignUp)?-120:120; [self.logInView2 setFrame:CGRectMake(self.logInView2.left-changeWidth, self.logInView2.top, self.logInView2.width + changeWidth, self.logInView2.height)]; }];
ios中使view向左移动,且右边不动
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。