我正在使用 iCarousel 在 CoverFlow 模式下显示我的自定义 UIView 但是当我运行我的应用程序时它会显示但里面什么都没有,就像不是我添加的视图???那你能帮我吗???
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
CustomView *temp;
if (view == nil)
{
//don't do anything specific to the index within
//this `if (view == nil) {...}` statement because the view will be
//recycled and used with other index values later
view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 315.0f, 350.0f)] autorelease];
temp=[[CustomView alloc] initWithFrame:view.bounds];
temp.backgroundColor=[UIColor redColor];
view.contentMode = UIViewContentModeCenter;
temp.tag=1;
[view addSubview:temp];
}
else
{
//get a reference to the label in the recycled view
temp = (CustomView *)[view viewWithTag:1];
}
//set item label
//remember to always set any properties of your carousel item
//views outside of the `if (view == nil) {...}` check otherwise
//you'll get weird issues with carousel item content appearing
//in the wrong place in the carousel
//label.text = [[items objectAtIndex:index] stringValue];
return view;
}