• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get a Category method?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a Category method?


  • Subject: Re: How to get a Category method?
  • From: Andreas Mayer <email@hidden>
  • Date: Mon, 15 Mar 2004 01:47:22 +0100

Am 15.03.2004 um 01:17 schrieb Rosyna:

Try the same thing with an instance method, not a class method.

Works fine for me ...

-------------
#import "MainController.h"

@interface NSString (mine)
- (NSString *)test;
@end

@implementation NSString (mine)
- (NSString *)test
{
return @"test";
}
@end


@implementation MainController

- (void)awakeFromNib
{
if ([@"a string" respondsToSelector:@selector(test)]) {
NSLog(@"string responds to test");
} else {
NSLog(@"string does not respond to test");
}
}

@end
--------------

This prints "string responds to test".


Andreas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: How to get a Category method?
      • From: Public Look <email@hidden>
References: 
 >Re: How to get a Category method? (From: Ondra Cada <email@hidden>)
 >Re: How to get a Category method? (From: Rosyna <email@hidden>)

  • Prev by Date: Re: How to get a Category method?
  • Next by Date: Re: How to get a Category method?
  • Previous by thread: Re: How to get a Category method?
  • Next by thread: Re: How to get a Category method?
  • Index(es):
    • Date
    • Thread