UIView *view = nil;
NSArray *subviews = [scrollView subviews];
CGFloat curXLoc = 0;
for (view in subviews)
{
if ([view isKindOfClass:[UIView class]] && view.tag > 0)
{
CGRect frame = view.frame;
frame.origin = CGPointMake(curXLoc, 0);
view.frame = frame;
curXLoc += (kScrollObjWidth);
}
}
I had placed one Scrollview, within this scroll view i place 5 UIImageview in XIB file
I have one image and one button, whenever I clicked the button the image should be loaded into all the UIImageviews within the UIScrollview programmatically.
and also I used the following coding
for(UIImageView *addview in Scroll)
{
if([addview isKindOfClass:[UIImageView class]])
{
UIImageView *newImage = (UIImageView *)addview;
newImage.image = [UIImage imageNamed:@"EarP010.jpg"];
}
}
Use this