Created
March 23, 2011 21:12
-
-
Save gorenje/883996 to your computer and use it in GitHub Desktop.
using tntooltip with timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation TNToolTip (WithTimer) | |
+ (TNToolTip)toolTipWithString:(CPString)aString | |
forView:(CPView)aView | |
closeAfter:(float)aSecondsValue | |
{ | |
var tooltip = [TNToolTip toolTipWithString:aString forView:aView]; | |
var stopInvoker = [[CPInvocation alloc] initWithMethodSignature:nil]; | |
[stopInvoker setTarget:tooltip]; | |
[stopInvoker setSelector:@selector(fadeOut)]; | |
[CPTimer scheduledTimerWithTimeInterval:aSecondsValue | |
invocation:stopInvoker | |
repeats:NO]; | |
if ( ![[[ConfigurationManager sharedInstance] pubProperties] showToolTips] ) { | |
[tooltip close]; | |
} | |
return tooltip; | |
} | |
- (void)fadeOut | |
{ | |
var thisDict = [CPDictionary dictionaryWithObjects:[self, CPViewAnimationFadeOutEffect] | |
forKeys:[CPViewAnimationTargetKey, | |
CPViewAnimationEffectKey]]; | |
var animation = [[CPViewAnimation alloc] initWithViewAnimations:[thisDict]]; | |
[animation setDuration:1.0]; | |
[animation setDelegate:self]; | |
[animation startAnimation]; | |
} | |
- (void)animationDidEnd:(id)sender | |
{ | |
[self close]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment