我新到iOS开发公司 -- I m 致力于在不同观点之间传递数据...
假设我有一个十个问题的列表。每个问题将有一个不同的页面,在介质之间有一个过渡,而UI将包含一个前置/下一个按钮,并包含为每个问题收集的输入。
我如何在“步骤”中显示每个问题并收集数据, 然后最终将一切保存为核心数据模型中的一个条目?
你能告诉我怎么做到的吗?
我新到iOS开发公司 -- I m 致力于在不同观点之间传递数据...
假设我有一个十个问题的列表。每个问题将有一个不同的页面,在介质之间有一个过渡,而UI将包含一个前置/下一个按钮,并包含为每个问题收集的输入。
我如何在“步骤”中显示每个问题并收集数据, 然后最终将一切保存为核心数据模型中的一个条目?
你能告诉我怎么做到的吗?
正如Inafziger提到的那样,最好在您最后的视图调用保存数据时使用一个单吨,而不是在每个视图的结尾使用,因为这会改善性能。这听起来似乎数据与您的整个应用程序有关。
如果是这样的话,我会说:
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain) NSPersistentStoreCoordinator *persistentStoreCoordinator;
在您的申请代表中,您可通过这种方式从任何地方获取信息,如果您需要从前一个问题获取信息,您可以非常方便地执行该操作。
希望这能帮上忙
Edit: (in regards to your comment)
假设您对每个问题都有相同或类似的布局, 您可以用不同的 pram e 来推动相同 < code> Viewcurrent 的新实例
UIViewController* myNewVC = [UIViewController alloc] init];
[myNewVC setQuestion:self.question+1];
[[AppDelegate sharedDelegate].navigationController pushViewController:myNewVC animated:YES]
UITViewC主计长总是UIView主计长, 但UIViewCentral却不是UITViewCentral。
This way you can display a new question each time and reuse the exact same ViewController
for each question
我会将问题存储在数据模型中,存储到一个有属性问题编号的问题实体中。然后,我会让查看控制器在 irvar 中跟踪当前问题编号。每次你向前或后退,都会增加或减少当前问题编号,然后从核心数据中获取问题。
我强烈建议避免将您的代码的不同部分与您的应用程序代表连接。 相反, 苹果会鼓励您通过设置属性或使用代表模式, 从查看控制器中传递必要的数据结构来查看控制器 。
For a basic app with nonconsumable in-app purchases, has anyone figured out best practices for using SKPaymentQueue s restoreCompletedTransactions? Observations I know it s recommended to always ...
I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...
I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I ...
I ve been working on adding in-app purchases and was able to create and test in-app purchases using Store Kit (yay!). During testing, I exercised my app in a way which caused the app to crash mid ...
In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...
Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...
I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...
Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...