Closed th1970 closed 1 year ago
The easiest way to do that is to specify the image and instructions on the task itself before it's added to the care store:
var task = OCKTask(...)
task.instructions = "Write your instructions here"
task.asset = "name-of-image-in-assets-catalog"
store.addTask(task)
If you happen to need even more control than that, you can override the method that's called when the detail disclosure is tapped. That method is called OCKTaskViewController.didSelectTaskView(taskView:eventIndexPath:)
. In that method you can instantiate and display a custom view controller that contains details for your task.
Sorry for the late reply. Thank you for answering. I was able to implement it following your advice. Thank you very much.
class AppDelegate: UIResponder, UIApplicationDelegate {
let careKitStore = populateSampleData2()
...
func populateSampleData2() -> OCKStore{
let store = OCKStore(name: "SampleAppStore4", type: .onDisk())
...
var nauseaSchedule = OCKSchedule(composing: [
OCKScheduleElement(start: beforeBreakfast, end: nil, interval: DateComponents(day: 1),
text: "随時", targetValues: [], duration: .allDay)
])
var nausea_1 = OCKTask(id: "nausea4", title: "便失禁あればクリック",
carePlanUUID: nil, schedule: nauseaSchedule)
nausea_1.instructions="便失禁は、便が漏れる状態で各年代7%程度存在すると言われています。\n骨盤体操は症状を改善する有効な手段です。"
nausea_1.asset = "IMAGE2"
store.addTasks(nausea_1, callbackQueue: .main){ result in
switch result{
case .failure(let error):
print("Error adding tasks_1: ")
case .success:
print("Successfully added tasks")
}
}
...
}
return store
}
Incredible! I'll go ahead and close this issue out.
Hello. In my carekit application, the nausea card task(which actually shows the fecal incontinence(便失禁))is displayed as follows.
I want to add an image and a description on the screen that appears when I click the” → “part, but I didn't know the class that does this. Anyone have any good ideas? Thanks in advance.