iCarousel上的二维数组不显示图像

时间:2015-12-01 03:50:10

标签: objective-c multidimensional-array icarousel

嗨,请帮助我是新手。我刚创建了一个二维数组并将其提供给Nick Lockwood iCarousel。想法是,当我尝试更改图像时,可以说从图像索引1到图像数组索引2的图像,将显示某些数据。我的问题是图像没有显示在我制作的轮播视图中。这是源代码。我已经搜索了我最好的但未能找到解决方案。

- (UIView *)carousel:(__unused iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view{
if (view == nil) {
    view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 260.0f, 260.0f)];
    view.contentMode = UIViewContentModeCenter;
}

for (NSArray* aSelection in self.itemCarousel) {
    NSLog(@"Data: %@", aSelection);

    UIImage *accmtImge = [aSelection objectAtIndex:2];
    UIImageView *myImageView = [[UIImageView alloc]initWithImage:accmtImge];
    myImageView.frame = view.frame;

    CALayer *imageLayer = myImageView.layer;
    [imageLayer setCornerRadius:5];
    [imageLayer setBorderWidth:1.8f];
    [imageLayer setBorderColor:[[UIColor colorWithRed:0.525 green:0.376 blue:0.557 alpha:1] CGColor]];
    [imageLayer setMasksToBounds:YES];
    [myImageView.layer setCornerRadius:myImageView.frame.size.width/2];
    [view addSubview:myImageView];
}
return view;}

0 个答案:

没有答案