开发者

How do I set the value of recipientItems in the following code snippet?

开发者 https://www.devze.com 2023-03-08 02:26 出处:网络
#import <UIKit/UIKit.h> @interface开发者_StackOverflow社区 AddRecipientsTableViewController : UITableViewController {
#import <UIKit/UIKit.h>
@interface开发者_StackOverflow社区 AddRecipientsTableViewController : UITableViewController {
NSMutableArray *recipientItems;
}
-(IBAction) btnLocalRecipients;
-(IBAction) btnRemoteRecipients;
-(IBAction) btnNext;
@end

In my implementation I have:

#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];

}

How do I set the value for recipientItems from within addLocalRecipientsTableViewController?


You have two options.

Option A Create an init method in your AddLocalRecipientsTableViewController that accepts a pointer to recipentItems.

I would choose option A if I would want to manage adding inside the viewController.

Option B Use NSNotifications to send a new recipient when it is created.

I would choose option B if I would want to manage all tasks related to recipientItems in one class AddRecipientsTableViewController.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号