如何在以下代码段中设置recipientItems的值?

时间:2011-05-22 20:23:07

标签: iphone ios uinavigationcontroller

#import <UIKit/UIKit.h>
@interface AddRecipientsTableViewController : UITableViewController {
NSMutableArray *recipientItems;
}
-(IBAction) btnLocalRecipients;
-(IBAction) btnRemoteRecipients;
-(IBAction) btnNext;
@end

在我的实施中,我有:

#import "AddRecipientsTableViewController.h"
#import "AddLocalRecipientsTableViewController.h"
#import "AddRemoteRecipientsTableViewController.h"


@implementation AddRecipientsTableViewController

-(IBAction) btnLocalRecipients{

    AddLocalRecipientsTableViewController *addLocalRecipientsTableViewController = [[AddLocalRecipientsTableViewController alloc]init];
    addLocalRecipientsTableViewController.navigationItem.title=@"Local Recipients";
    [self.navigationController pushViewController:addLocalRecipientsTableViewController animated:YES];
    [addLocalRecipientsTableViewController release];

}

如何在addLocalRecipientsTableViewController中设置recipientItems的值?

1 个答案:

答案 0 :(得分:1)

您有两种选择。

选项A 在AddLocalRecipientsTableViewController中创建一个init方法,该方法接受指向recipentItems的指针。

如果我想在viewController中管理添加,我会选择选项A.

选项B 使用NSNotifications在创建新收件人时发送新收件人。

如果我想在一个AddRecipientsTableViewController类中管理与recipientItems相关的所有任务,我会选择选项B.

相关问题