【发布时间】:2012-03-26 23:31:32
【问题描述】:
我的应用程序委托中有一组用户,并且在其中一个屏幕中我试图创建一个对象以添加到该数组中。用户属性只有电子邮件和密码。在屏幕上,我有两个文本字段和一个按钮。我想要它,这样当按下按钮时,它会根据输入到字段中的内容生成一个新用户,并将其放入应用程序委托中的用户数组中。
抱歉学习了堆栈溢出接口atm。我正在使用以下代码:
-(IBAction)addPerson:(id)sender:(ContactViewController *)controller
{
Person *newPerson = [Person personWithEmail:controller.usernameTextField.text password:controller.passwordTextField.text];
[self.(Truck_Tracker_AppAppDelegate *)UIApplication.sharedApplication.delegate).listPeople addObject:newPerson];
}
我认为我已经成功创建了 Person 对象 newPerson,但我无法将它传递给应用委托。
【问题讨论】:
-
你能发布你到目前为止的代码吗?
-
等等,你的问题到底是什么?
-
-(IBAction)addPerson:(id)sender:(ContactViewController *)controller { Person *newPerson = [Person personWithEmail:controller.usernameTextField.text password:controller.passwordTextField.text]; [self.(Truck_Tracker_AppAppDelegate *)UIApplication.sharedApplication.delegate).listPeople addObject:newPerson]; }
标签: objective-c ios cocoa-touch nsmutablearray