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

View Single Post
Old 04-23-2009, 06:08 AM   #62 (permalink)
blackyE
Registered Member
 
blackyE's Avatar
 
Join Date: Aug 2008
Location: Germany
Posts: 78
blackyE is on a distinguished road
Default

Hi,

its possible to reload a image when i switch to a view again?

Because the image displayed after 5seconds. But when I again switch to the view, only the sound plays but not the image is showing!
Should i have to do that with the method viewDidDisappear?

Code:
- (void)showImage {
	UIImage *hintergrund = [UIImage imageWithData: [[NSUserDefaults standardUserDefaults] objectForKey: @"UserDefinedImage"]];
	if (!hintergrund) hintergrund = [UIImage imageNamed: @"scaryface.png"];
	faceView.image = hintergrund;
	[UIView beginAnimations:nil context:faceView];
	[UIView setAnimationDelay:0.5];
	[UIView setAnimationDuration:0.25];
	[faceView setAlpha:0.0];
	[UIView commitAnimations];
	CFBundleRef mainBundle;
	mainBundle = CFBundleGetMainBundle ();
	soundFileURLRef = CFBundleCopyResourceURL (mainBundle,CFSTR ("schrei"),CFSTR ("aif"), FALSE);
	AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject);
	AudioServicesPlaySystemSound (self.soundFileObject);	
	AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
	[[NSUserDefaults standardUserDefaults] removeObjectForKey: @"UserDefinedImage"];
	[[NSUserDefaults standardUserDefaults] synchronize]; // Sofort löschen + Speicher freimachen
}

- (void)viewWillAppear:(BOOL)animated {
	if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ShowScaryFace"])
	[self performSelector:@selector(showImage) withObject:nil afterDelay:5.0]; 
	[super viewWillAppear:animated];

}
thnaks!
blackyE is offline   Reply With Quote
 

» Advertisements
» Online Users: 447
18 members and 429 guests
apatsufas, bdavid186, BumChinBooth, ChrisYates, desbrina, falco1973, iLearnColors, LegionMD, Lisafleu, LunarMoon, milanalina, PavelMik, pipposanta, Robemtims, themartist, Wikiboo, ziocleto, zzeze
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,620
Threads: 94,087
Posts: 402,801
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Lisafleu
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:51 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.