UIViewのレイヤーにサブレイヤとしてシャドーレイヤーを追加しました。私はshadowSubviewとUIView
のアニメーションをリサイズの一部としてそれを維持したいと思いますUIView:影でCALayerフレームをアニメーション化する方法は?
- (void)addDefaultShadowSubview {
self.shadowSubview = [[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height)] autorelease];
CALayer *shadowLayer = [CALayer layer];
shadowLayer.backgroundColor = self.backgroundColor.CGColor;
shadowLayer.shadowOffset = CGSizeMake(0, 3);
shadowLayer.shadowRadius = 5.0;
shadowLayer.shadowColor = [UIColor blackColor].CGColor;
shadowLayer.shadowOpacity = 0.8;
shadowLayer.frame = self.shadowSubview.frame;
[self.shadowSubview.layer addSublayer:shadowLayer];
self.shadowSubview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self addSubview:self.shadowSubview];
[self sendSubviewToBack:self.shadowSubview];
}
:UIView
サブクラスのための追加の方法を示します。正しい方法を知っている私を助けてください
[UIView animateWithDuration:durationDefaultAnimation
animations:^{
[self.viewWithShadowSubview setFrame:enlargedFrame];
}
completion:^(BOOL finished) {
[self modifyInsetForCurrentImageviewWithAnimation:YES];
}];
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
を使用しながら、しかし、それを行うための正しい方法を見つけることができません。 CABasicAnimation
について学習しようとしましたが、このケースに適用する方法が見つかりません。
なぜあなたは上の影を設定されていませんshadowSubviewレイヤー? –