我已将[{1}}子类化为基本上包含UIView
和UIPickerView
。
当用户选择选择器中的特定行时,我将在选择器上添加UIToolbar
。但是,当我为UIImageView
设置动画以向上滑动屏幕时,此图像不可见。如果我没有为UIView
设置动画,那么它将正确显示。
我正在显示这样的UIView
(在UIImageView
中):
UIView
这是我将- (void)showMailSetupPopover {
if (self.popoverMailSetupImageView == nil) {
UIImageView *popoverMailSetupImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"popover-mail-setup-addreminder"]];
popoverMailSetupImageView.alpha = 0.0;
popoverMailSetupImageView.frame = CGRectMake(8, self.frame.origin.y + 65, popoverMailSetupImageView.bounds.size.width, popoverMailSetupImageView.bounds.size.height);
self.popoverMailSetupImageView = popoverMailSetupImageView;
}
[self addSubview:self.popoverMailSetupImageView];
[UIView animateWithDuration:0.5 animations:^{
self.popoverMailSetupImageView.alpha = 1.0;
} completion:^(BOOL finished) {}];
}
添加到UIView
:
self.view
答案 0 :(得分:0)
发现问题,
代替
popoverMailSetupImageView.frame = CGRectMake(8, self.frame.origin.y + 65, popoverMailSetupImageView.bounds.size.width, popoverMailSetupImageView.bounds.size.height);
与
popoverMailSetupImageView.frame = CGRectMake(8, 65, popoverMailSetupImageView.bounds.size.width, popoverMailSetupImageView.bounds.size.height);
self.frame.origin.y
不需要。