Iphone 如何在imageview中添加多个标签?

Iphone 如何在imageview中添加多个标签?,iphone,ios5,xcode4.3,Iphone,Ios5,Xcode4.3,我是这个iphone开发的新手。我现在遇到了一个问题。在我的应用程序中,我需要显示多个标签的coverflow。因此,我为view添加了一个图像作为子视图,然后为image view添加了标签作为子视图。对于前7个元素,每件事情都可以正常工作,但当我滚动时,它显示的是相同的元素再次出现 我正在使用 这是为了达到覆盖流 - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusin

我是这个iphone开发的新手。我现在遇到了一个问题。在我的应用程序中,我需要显示多个标签的coverflow。因此,我为view添加了一个图像作为子视图,然后为image view添加了标签作为子视图。对于前7个元素,每件事情都可以正常工作,但当我滚动时,它显示的是相同的元素再次出现 我正在使用 这是为了达到覆盖流

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


UIImageView *imageView =nil;
UILabel *yourLabel=nil;
UILabel *yourLabel1=nil;
UILabel *yourLabel2=nil;
cardAvailableDataObject *singleCard=[self.cards objectAtIndex:index];

if (view == nil)
{
    //set up reflection view
    view = [[[ReflectionView alloc] initWithFrame:CGRectMake(0,0,200,self.view.frame.size.width/1.42)] autorelease];
    imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(0,0,200,self.view.frame.size.width/1.42)];
    [view addSubview:imageView];

    yourLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -5, 200, 50)];
    yourLabel.textAlignment = UITextAlignmentCenter;


    [yourLabel setTextColor:[UIColor colorWithRed:(38/255.f) green:(171/255.f) blue:(226/255.f) alpha:1.0f]];  
    [yourLabel setBackgroundColor:[UIColor clearColor]];
    [yourLabel setFont:[UIFont fontWithName: @"Trebuchet MS" size: 17.0f]]; 
    [imageView addSubview:yourLabel];


    yourLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(90, 40, 300, 20)];


    [yourLabel1 setTextColor:[UIColor blackColor]];
    [yourLabel1 setBackgroundColor:[UIColor clearColor]];
    [yourLabel1 setFont:[UIFont fontWithName: @"Trebuchet MS" size: 12.0f]]; 
    [imageView addSubview:yourLabel1];




    yourLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(90, 61, 300, 20)];

    [yourLabel2 setTextColor:[UIColor blackColor]];
    [yourLabel2 setBackgroundColor:[UIColor clearColor]];
    [yourLabel2 setFont:[UIFont fontWithName: @"Trebuchet MS" size: 12.0f]]; 
    [imageView addSubview:yourLabel2];


}
else
{
    imageView = [[view subviews] lastObject];
    yourLabel = [[imageView subviews] lastObject];
    yourLabel1 = [[imageView subviews] lastObject];
    yourLabel2= [[imageView subviews] lastObject];
}



 yourLabel.text=singleCard.name; 

 yourLabel2.text=singleCard.companyname; 
 yourLabel1.text=singleCard.designation;
 imageView.image=[profile objectAtIndex:index];


return view;



  }

这是我的代码。有人能建议如何解决这个问题吗?

在其他部分保留一个断点,并检查您是否获得标签我的意思是说,您是否能够在其他部分获得标签的引用。是的,我获得了引用。现在的问题是,只有一个标签得到更新,而另一个仍然是相同的访问方式按标签显示标签和图像视图