在我的轮播和我的自定义动画中出现问题

时间:2012-06-28 06:31:35

标签: iphone ios xcode uianimation icarousel

我创建了应用程序启动图像必须动画的应用程序,我的按钮将使用icarousel以coverflow效果显示..这是我的代码

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
carousel.type = iCarouselTypeInvertedWheel              ;

CGRect ChaintopFrame = Chaintop.frame;
ChaintopFrame.origin.y = self.view.bounds.size.height;    
//CGRect ChainbottomFrame = Chainbottom.frame;
//ChainbottomFrame.origin.y = self.view.bounds.size.height;

[UIView animateWithDuration:0.5
                      delay:1.0
                    options: UIViewAnimationCurveEaseOut
                 animations:^{
                  Chaintop.frame = ChaintopFrame;
                     //Chainbottom.frame = ChainbottomFrame;
                 } 
                 completion:^(BOOL finished){
                     NSLog(@"Done!");
                 }];
}


- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{

   UIImage *buttonImage=[NSArray arrayWithObjects:[UIImage imageNamed:@"Cover_0.png"],
                      [UIImage imageNamed:@"Cover_1.png"],
                      [UIImage imageNamed:@"Cover_2.png"],
                      [UIImage imageNamed:@"Cover_3.png"],
                      [UIImage imageNamed:@"Cover_4.png"],
                      [UIImage imageNamed:@"Cover_5.png"],
                      [UIImage imageNamed:@"Cover_6.png"],
                      [UIImage imageNamed:@"Cover_7.png"],nil];

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 200.0f, 200.0f);

[button setImage:(UIImage*)[buttonImage objectAtIndex:index] forState:UIControlStateNormal]; 

[button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
return button;



 }

现在,当我运行我的模拟器时,用于动画的图像返回并且按钮显示在前面。好处是动画旅馆图像正在工作......我也重新调整了我的icarousel视图......

我错过了什么吗?...

1 个答案:

答案 0 :(得分:1)

我认为您在imageView视图中添加了iCarousel错误, 试试这个:

[self.view addSubview:Chaintop];

并尝试调整图片大小。

希望这会有所帮助。