如何设置以下代码片段中的recipientItems的值?
#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 的值?
#import <UIKit/UIKit.h>
@interface 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有两个选择。
选项A
在 AddLocalRecipientsTableViewController 中创建一个 init 方法,该方法接受指向recipientItems 的指针。
如果我想在 viewController 中管理添加,我会选择选项 A。
选项B
创建新收件人时,使用 NSNotifications 发送该收件人。
如果我想在一个类 AddRecipientsTableViewController 中管理与收件人项目相关的所有任务,我会选择选项 B。
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.