UIViewのレイヤーにシャドウレイヤーをサブレイヤーとして追加しました。UIView
以下は、サブクラスの追加メソッドです。
- (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
ShadowSubview を使用した an のサイズ変更アニメーションの一部として保持したいと思います。しかし、使用中に正しい方法を見つけることができません+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
[UIView animateWithDuration:durationDefaultAnimation
animations:^{
[self.viewWithShadowSubview setFrame:enlargedFrame];
}
completion:^(BOOL finished) {
[self modifyInsetForCurrentImageviewWithAnimation:YES];
}];
正しい方法を知るのを手伝ってください。について学習しようとしましCABasicAnimation
たが、このケースに適用する方法が見つかりません。