0
我有一個Advertisement UIViewController類,它包含下面的代碼。該框架是圖像的確切尺寸。當它動畫下來時,我希望它在76.0點消失。我使UIViewController的框架與圖片的大小相同,但當它向下滑動時,它不會遮擋任何圖片。當它離開UIViewController的框架時掩蓋UIImageView
如何使它在離開UIViewController框架時看不到uiimageview?
-(void)viewDidLoad{
UIImageView *ad = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 76.0)];
ad.image = [UIImage imageNamed:@"advertisement.jpg"];
[self.view addSubview:ad];
[ad release];
[UIView animateWithDuration:1.0 //animate the content offset
delay:6.0
options:UIViewAnimationCurveEaseIn
animations:^{
ad.frame = CGRectMake(0.0, 152.0, 320.0, 76.0); }
completion:^(BOOL finished){
}
];
}
的appDelegate:
Advertisement *theAdView = [[Advertisement alloc] init];
theAdView.view.frame = CGRectMake(0.0, self.window.frame.size.height-120.0, 320.0, 76.0);
[self.window addSubview:theAdView.view];