Hi,
I am putting an Array of Images into a UIScrollView with this code:
Code:
for (i=0; i < count; i++ ){
if ((i != 0) && (i % 4 == 0)) row += 1;
if ((i != 0) && (i % 8 == 0)) {
page += 1;
row = 0;
}
UIImage *imageLoop = [UIImage imageNamed:[[companyName objectAtIndex:i ]stringByAppendingString:@"_basis.png"]];
UIButton *button = [[UIButton alloc] init];
x = (i % 4) * 110 + 10;
y = row * 80;
[button setImage:imageLoop forState:UIControlStateNormal];
[button setImage:imageLoop forState:UIControlStateHighlighted];
[button addTarget:self action:@selector(productImagePressed:) forControlEvents:UIControlEventTouchUpInside];
button.tag = t;
button.frame = CGRectMake(page * 480 + x, y, 100, 100);
[scrollView addSubview:button];
t = t + 1;
[button release];
}
The Array will be counted using count(*) from my sqlite DB. On another view I am able to delete entries from the DB (which is updating the count). So far so good, everything is working, unless the Images will not be updated. If there are 8 images in the view (when I first enter it), and I delete 2 images from the DB, the number of count is: 6 but, there are still 8 images which are shown.
I tried to update using
- (void)viewDidAppear

BOOL)animated;
- (void)viewWillAppear

BOOL)animated;
Everywhere, but the UIScrollView will not be updated...
Thanks for any Feedback or Hints...
BR,
Stefan