0

我有 3 个对象:A、B 和 C。

A 和 C 通过 B 实现的两个协议(比如 A1 和 C1)通过 B 进行通信。

具体来说,A的接口是:

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

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

C的接口是:

@interface C : UIViewController {
      IBOutlet UITableView *exportTableView;

      id <C1> willBe_B;
}

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

B的界面是:

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

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

C viewController 控制一个表(数据从应用程序委托中的 NSMutableArray 检索):用户可以选中/取消选中该表中的行。

我会将与用户选择的行相对应的索引保存在 C 中,这样 A 可以使用它们来导出相应的数据。

我不知道什么是正确的方法来做到这一点。

4

1 回答 1

0

试着看看 NSIndexSet 和 NSMutableIndexSet。这两种类型在设计时考虑了存储数组索引。

于 2011-03-17T16:46:45.573 回答