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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 04-18-2009, 09:47 PM   #9 (permalink)
Legrend
New Member
 
Join Date: Mar 2009
Location: Covina, California - United States
Age: 28
Posts: 22
Default

Quote:
Originally Posted by DGYWFT View Post
My problem is when i set the delegate to self the app freezes. If I set it to anything else, it will only run the fadeup, but then never calls fade down. Know any way to fix this? The CALayer subview (theColorA) is in my custom view class 'mainview'
Any tips?

Can you be more specific as to what happens when the app freezes? Does it compile and then freeze when it gets to that block of code? If so, I had this problem already with an infinite loop from callbacks, but I don't remember how I solved it. I'd have to look at the code. If you can give me any more specific details, that might help. I'm no pro though, so I can't guarantee I can solve it, hehe.

As another note: I highlighted in bold the next part I want to mention. The delegate is like your doorway to other parts of your app. By setting the delegate to "self", you're telling it that the current view controller contains all delegate methods/functions, and that the application should look to "self" or whatever view controller you set to find whatever methods it needs to call. So, by setting the delegate to something else, you'd also have to put the fadeImageDown method wherever you set the delegate. Did you move it when you tried setting it to another view controller?

WARNING: I've been off iPhone for about a week and my memory can go fast at times, but I 'think' you have to set a view controller as your delegate. Anyone who can confirm this would be great. Maybe the area you are calling this code isn't from a view controller?


I'd just like to point out that you are setting an infinite loop of callbacks. So as long as whatever screen is on the stack that is using this code, it will constantly be executing it. If this is the desired effect, that's fine, but I would still wrap it in a conditional:
Code:
- (void) fadeImageUp 
{
     if (!done)
     {
	  [UIView beginAnimations:nil context:nil];
	  [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
	  [UIView setAnimationDuration:3.0];
	  [UIView setAnimationDelegate:self];
	  [UIView setAnimationDidStopSelector:@selector(fadeImageDown)];
	  mainview.theColorA.opacity = 1.0;
	  [UIView commitAnimations];
     }
}

Sorry for the mouthful. Let me know how it goes (good OR bad), and post either relevant info for others to share/learn from.
Legrend is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,808
Threads: 89,206
Posts: 380,627
Top Poster: BrianSlick (7,129)
Welcome to our newest member, kaileymo123
Powered by vBadvanced CMPS v3.1.0

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