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 08-18-2011, 04:20 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 1
pprajoth is on a distinguished road
Default Need Help with applicationDidBecomeActive

Hey guys. I have been trying for days to get this code to work, but I have no idea what I am doing wrong. Everytime the app wakes up from sleep, or the user closes the app and opens it again (without closing the app from multitasking), I want a label value to change.
In my applicationDidBecomeActive, I am running a counter, which I want to display on whatever viewcontroller is open at that moment.

Code:
- (void)applicationDidBecomeActive:(UIApplication *)application {
	counter = counter + 1;
    
	W1G1 *view1 = [[[W1G1 alloc] initWithNibName:@"W1G1" bundle:nil] retain];
	[view1 setlabel];
}
In my viewcontroller W1G1, I have the following code:
Code:
- (void) setlabel {
	NSString *string = [NSString stringWithFormat:@"%d", counter];	
	vocabword.text = string;
}
I have imported W1G1 in my appdelegate, but the code does not run Please help!

Thanks
pprajoth is offline   Reply With Quote
Old 08-19-2011, 12:48 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 29
harryvermeulen is on a distinguished road
Default

How about changing your setlabel function to:
Code:
- (void)setLabel:(double)counter {
    NSString *string = [[NSString alloc] initWithFormat:@"%d", counter];
    vocabword.text = string;
}
and then calling:
Code:
[view1 setLabel:counter];
harryvermeulen is offline   Reply With Quote
Reply

Bookmarks

Tags
appdelegate, didbecomeactive, iphone

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: 391
14 members and 377 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, jimmyon122, jonathandeknudt, pungs, raymng, stanny, tymex, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

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