I have 3 object: A, B and C.

A and C communicate through B via two protocols (say A1 and C1) implemented by B.

In particular, the A's interface is:

@interface A : NSObject {
      id <A1> willBe_B;
}

@property (nonatomic, assign) id <A1> willBe_B;

The C's interface is:

@interface C : UIViewController {
      IBOutlet UITableView *exportTableView;

      id <C1> willBe_B;
}

@property (nonatomic, assign) id <C1> willBe_B;

The B's interface is:

@interface B : UIViewController <A1, B1> {
         A *refToA;
         C *refToC;
}

@property (nonatomic, retain) A *refToA;
@property (nonatomic, retain) C *refToC;

The C viewController controls a table (the data are retrieved from a NSMutableArray in the app delegate): the user can check/uncheck row in this table.

I would save in C the indexes corresponding to rows selected by the user, in a such way that A can use them to export the corresponding data.

I don't know what could be a proper way to do this.

有帮助吗?

解决方案

Try taking a look at NSIndexSet and NSMutableIndexSet. These two types were designed with storing array indexes in mind.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top