0

我创建了 d 应用程序,其中应用程序启动图像必须是动画的,并且我的按钮将使用 icarousel 以封面流效果显示。这是我的代码

- (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 视图的大小......

我错过了什么吗?...

4

1 回答 1

1

我认为你imageView在你的观点中添加了你的错误iCarousel,试试这个:

[self.view addSubview:Chaintop];

并尝试调整图像大小。

希望这可以帮助。

于 2012-06-28T09:06:46.403 回答