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 07-16-2010, 05:37 AM   #1 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Johanovski is on a distinguished road
Default How to refresh a UIView?

Hi there!

I'm working in an app that uses a UIView. Inside this UIView there is a UILabel properly declared as a property of the UIView's viewController. In fact the app is a simple backtracking functions test (no commercial use, just for fun hehe). I'm logging each backtracking step (the made "path") in the console, but I want it to be logged in the UILabel. However, though I'm changing the UILabel's text in my loop functions, it doens't get refreshed until the whole function is ended. I'm doing a more simple test with a simple loop (no backtracking yet) to try get the UILabel updated at every loop, here it is:
Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
	NSString *str;
	
	for (int i=0; i<99999; i++) {
		str = @"";
		
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		str = [str stringByAppendingFormat:@"%d",arc4random() % 10];
		
		[self.lblMain setText:str];
	}
}
And yes, the label is declared as a property, IBOutlet, correctly associated with the IB's UILabel, and seems that everything have to work well, but it's like if the screen just get updated when a function is finished so my label just shows: "Paths" just before touching the screen and, when I touch it, it just "freezes" during the loop and after that just shows the last number...

EDIT: And yes, I've already tried [self.view setNeedsDisplay] and it doesn't make a change...

Is there any kind of "[self.view refresh]" function or something like this?

Thanks in advance!

Last edited by Johanovski; 07-16-2010 at 05:42 AM.
Johanovski is offline   Reply With Quote
Reply

Bookmarks

Tags
refresh, uilabel, uiview, uiviewcontroller, update screen

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: 336
15 members and 321 guests
akphyo, alexP, appservice, cgokey, EXOPTENDAELAX, flamingliquid, guusleijsten, mariano_donati, ohmniac, Paul Slocum, PavelSea, Rudy, SLIC, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,653
Threads: 94,115
Posts: 402,888
Top Poster: BrianSlick (7,990)
Welcome to our newest member, ohmniac
Powered by vBadvanced CMPS v3.1.0

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