Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-28-2010, 03:55 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Wien/Austria
Posts: 242
StefanL is on a distinguished road
Default UI will not be updated after deleting

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)viewDidAppearBOOL)animated;
- (void)viewWillAppearBOOL)animated;

Everywhere, but the UIScrollView will not be updated...

Thanks for any Feedback or Hints...

BR,

Stefan
StefanL is offline   Reply With Quote
Old 10-28-2010, 04:18 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

it looks like you're always adding images to the scrollview, i dont see anywhere that you are removing them..
smithdale87 is offline   Reply With Quote
Old 10-28-2010, 04:21 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Wien/Austria
Posts: 242
StefanL is on a distinguished road
Default

Hi Smithdale,

thanks for your reply! I thought, that when I am "drawing" the UIScrollview with the new number of images, that those which have been deleted should be gone automatically...

Am I wrong?

Thanks for your advice!

BR,

Stefan
StefanL is offline   Reply With Quote
Old 10-29-2010, 12:43 AM   #4 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Wien/Austria
Posts: 242
StefanL is on a distinguished road
Default

Hi,

this does it...

Code:
[scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
BR,

Stefan
StefanL is offline   Reply With Quote
Reply

Bookmarks

Tags
uiscrollview, update

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 326
12 members and 314 guests
7twenty7, chiataytuday, condor304, Creativ, Domele, dreamdash3, laureix68, LEARN2MAKE, mistergreen2011, mottdog, palme2elie, Paul Slocum
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,660
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, laureix68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:23 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0