繁体   English   中英

UIView transitionWithView丢弃图层设置

[英]UIView transitionWithView discarding layer settings

我viewDidload我有如下设置:

    [[self layer] setCornerRadius:30.0f];
    NSString *imgFilepath = [[NSBundle mainBundle] pathForResource:@"imageName" ofType:@"jpeg"];
    backImg = [[UIImage alloc] initWithContentsOfFile:imgFilepath];

然后按下一个按钮,我正在做一个transitionWithView:viewPressed,如:

    [UIView transitionWithView:viewPressed duration:0.5
                       options:UIViewAnimationOptionTransitionFlipFromLeft
                    animations:^{                            
                        [self setImage:img];
                        [self setFrame:useFrame]; // Just a bigger frame
                        [((UIView*)self) bringSubviewToFront:viewPressed];                            
                    }
                    completion:NULL];

我有很好的圆角,但是当转换开始时它会在动画之前获得方角。

希望我能解释清楚吗?

谢谢

什么是第二个代码块中的自我引用?

我假设self是自定义视图,setImage设置其图层的内容,然后使用

[[self layer] setMasksToBounds:YES];

就在setCornerRadius之后, setCornerRadiussetCornerRadius

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM