[英]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
之后, setCornerRadius
我setCornerRadius
!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.