• 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: Can you @synthesize simple arrays?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can you @synthesize simple arrays?


  • Subject: Re: Can you @synthesize simple arrays?
  • From: "Clark Cox" <email@hidden>
  • Date: Mon, 17 Nov 2008 07:20:39 -0800

On Mon, Nov 17, 2008 at 7:14 AM, Greg Robertson <email@hidden> wrote:
> I have a couple of simple ivar arrays:
>
> NSString   *myString[4];
> NSInteger   myInteger[4];
>
> How can I @synthesize these so I can access them with simple dot notation:

I'm not sure that you can. However, this should get you the interface
that you want:

@interface MyClass :NSObject {
  NSString *myString[4];
  NSInteger *myInteger[4];
}

@property (readonly) NSString **myString;
@property (readonly) NSInteger *myInteger;
@end

@implementation MyClass

-(NSString**)myString {
  return myString;
}

-(NSInteger*)myInteger {
  return myInteger;
}

@end

>
> ie.  self.myInteger[2] = 100;
>
> I have tried several ways to set them up in the @interface but I keep
> getting compile errors. Could someone show me the proper @property or
> is this not possible?
>
> I would prefer to avoid NSArray if I can.


--
Clark S. Cox III
email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can you @synthesize simple arrays?
      • From: "Michael Ash" <email@hidden>
References: 
 >Can you @synthesize simple arrays? (From: "Greg Robertson" <email@hidden>)

  • Prev by Date: Can you @synthesize simple arrays?
  • Next by Date: NSButtonCell slowdown in NSTableView
  • Previous by thread: Can you @synthesize simple arrays?
  • Next by thread: Re: Can you @synthesize simple arrays?
  • Index(es):
    • Date
    • Thread