iphone - 如何设置以下代码片段中的recipientItems的值?

标签 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 的值?

最佳答案

您有两个选择。

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

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

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

如果我想在一个类 AddRecipientsTableViewController 中管理与收件人项目相关的所有任务,我会选择选项 B。

关于iphone - 如何设置以下代码片段中的recipientItems的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6090555/

相关文章:

iphone - 如何在从 UINavigationController 弹出 UIViewController 之前显示警报

iphone - 如何重置与 iPhone 版 Google Analytics 的 session ?

iphone - iPhone AudioSession属性

iphone - 如何将数据从 SQlite 显示到 TableView 到 iPhone 应用程序

ios - popToViewController 和内存管理

ios - Xcode - 设置要在多个 View Controller 中使用的全局内容的最佳方式?

iPhone 开发 : Creating sliding drawers like Path and Facebook apps

ios - 应用程序卡住核心数据

ios - UIViewController presentViewController :animated:completion - taking 4 to 6 seconds to launch

iOS 11 navigationItem.titleView 宽度未设置