Subview that is currently visible

Discussion in 'iOS Programming' started by xnakx, Oct 5, 2008.

  1. xnakx macrumors newbie

    Joined:
    Oct 5, 2008
    #1
    I have a UIScrollView with 5 UIImageViews (with unique tags) as subviews
    how do i get the tag of the UIImageView that is currently displayed?
    I am trying to update a UILabel's text to something like "Image x out of 5". from within scrollViewDidScroll

    Jason
     
  2. xnakx thread starter macrumors newbie

    Joined:
    Oct 5, 2008
    #2
    found it.
    someone else pointed me to
    Code:
    CGFloat pageWidth = scrollView.frame.size.width;
        int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
    label.text=text = [NSString stringWithFormat:@"Image: %d",page];	
     

Share This Page