• 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: Checking the type...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking the type...


  • Subject: Re: Checking the type...
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 13 Mar 2003 19:51:11 -0800

On Thursday, March 13, 2003, at 07:39 PM, Hussain Bandukwala wrote:

I have entries of various types (NSString, etc.) in an NSMutableArray and was wondering if there is a way to check for these types. I would like to perform different functions on the entries if they are of the NSString type and different functions if they are of some other type. Could someone please tell me what method(s) to use for checking for the NSString type?

Use "-isKindOfClass" and "+class" to do this. For example, given a class named "class":

if ([class isKindOfClass:[NSString class]] == YES)
{
// if your code gets to this point, then class is an NSString or inherits from NSString
}

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://dreamless.home.attbi.com/

Smile! It confuses people!
_______________________________________________
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: Checking the type...
      • From: "Kenneth C. Dyke" <email@hidden>
References: 
 >Checking the type... (From: "Hussain Bandukwala" <email@hidden>)

  • Prev by Date: Cocoa and standard Java
  • Next by Date: Re: NSObject performSelectorOnMainThread:
  • Previous by thread: Checking the type...
  • Next by thread: Re: Checking the type...
  • Index(es):
    • Date
    • Thread