I'm trying to initialise a custom viewcontroller and send a parameter with it but can't figure it out.
To sketch an idea:
I want to have different settings per sport (walking, running, ...) and save those in core data on the custom viewcontroller.
To know to which sport the settings belong to I need to know what sport the user tapped to get to that screen. I was thinking about doing this by sending a parameter, using a custom init for each sport or by getting the key. All of which I can't figure out.
I've looked into this issue and tried to do it like this: (item 4)
But that doesn't work, according to the IASK docs I think I also need to specify a file, but what file?
The selector must have two arguments: an NSString argument for the file name in the Settings bundle and the IASKSpecifier.
I've tried setting a File field and tried different values but without success.
I'm seriously lost here, if it's possible to get the key of the item that initialised the controller ("running" for item 4 for example) that would also be good.
I've tried so many different things I'm losing my mind, I'm obviously doing something very wrong but I have no idea what it is.
You don't need to specify an
IASKSpecifier
key in yourSettings.plist
. The way this works is you implementSettingsPerSportViewController.m
:However, this means you build the settings view controllers for your sports on your own and don't use IASK for that.
If all sports share the same settings and you want to use IASK to generate the settings view controller, you could implement a custom settings storage and use the same
Sport.plist
for all sports. Your custom settings storage could then load from and save directly to Core Data. Asport
property would then route the load and save operations to the right Core Data context or table.At the root level you could have a simple static view controller that sets up and pushes an
IASKAppSettingsViewController
for each sport with thesettingsStore
property set to your custom storage subclass and thesport
property set according to the selected sport.