小编use*_*114的帖子

shadowOffset在iOS中做了什么?

我无法在任何地方找到这些信息,所以问这里.

究竟element.layer.shadowOffset = CGSizeMake(2.0, 2.0)]做了什么?

它对元素的偏移量是多少?

ios ios7

8
推荐指数
2
解决办法
9364
查看次数

IOS:执行动画时视图高度会降低

当键盘出现在文本字段上时,我有以下代码用于上下移动视图.

-(void)textFieldDidBeginEditing:(UITextField *)textField{
    NSLog(@"height before animation%f",self.view.frame.size.height);
    NSLog(@"%f",self.view.frame.size.height);
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    [self.view setFrame:CGRectMake(0,-216,320,460)];
    [UIView commitAnimations];
}

-(void)textFieldDidEndEditing:(UITextField *)textField{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    [self.view setFrame:CGRectMake(0,0,320,460)];
    [UIView commitAnimations];
    NSLog(@"height after animation %f",self.view.frame.size.height);
    }
Run Code Online (Sandbox Code Playgroud)

这是我在键盘出现然后编辑完成时得到的示例日志:

2014-01-21 11:00:51.194 Master-view[456:70b] height before animation 568.000000
2014-01-21 11:00:53.635 Master-view[456:70b] height after animation 460.000000
Run Code Online (Sandbox Code Playgroud)

视图的高度似乎降低了,这使得屏幕的底部不可互动.为什么会这样?

视图正在向上移动,也没有问题.在视觉上似乎没有区别.在升空之前存在的所有元素都在下降后存在.但是屏幕底部的元素(超过460.0的高度)并不难解决.

cocoa-touch ios

0
推荐指数
1
解决办法
206
查看次数

标签 统计

ios ×2

cocoa-touch ×1

ios7 ×1