On Jul 2, 2008, at 9:23 AM, Mike Abdullah wrote:

On 2 Jul 2008, at 15:09, Papa-Raboon wrote:

I have a bit of static text I set with a value of: @"record Added"
with the following: [complete setStringValue:@"Record added"]; and I
want it to disappear after 3 seconds and I thought the easiest way
would be to just change the value to: @"" with a timer.

Currently I have this: [self setStringValue:complete withObject:@""
afterDelay:3.0];

Which doesn't seem to work and has the following warning:

'mainController' may not respond to '- setStringValue:withObject:afterDelay:'

What am I doing wrong please and what should my code really be?

Well the compiler is telling you exactly what is wrong; mainController doesn't respond to the - setStringValue:withObject:afterDelay: message. Instead, you need to do:

[self performSelector:@selector(setStringValue:) withObject:@"" afterDelay:3.0];

Actually, since the original receiver of the message is "complete", it (not "self") should still be the receiver of the performSelector:withObject:afterDelay:.

Like so:

[complete performSelector:@selector(setStringValue:) withObject:@"" afterDelay:3.0];

Cheers,
Ken
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to