0
我在Swift上爲iPhone iOS 9.1使用Xcode 7.1.1與ResearchKit編碼。我正在嘗試創建同意頁面,並一直在網上尋找試圖找到沒有成功的例子。如何在ResearchKit上創建個體同意頁面?
從http://www.raywenderlich.com/104575/researchkit-tutorial-with-swift,我已經得到了代碼:
import Foundation
import ResearchKit
public var ConsentDocument:ORKConsentDocument {
let consentDocument=ORKConsentDocument()
consentDocument.title = "Consent"
//Consent Sections
let consentSectionTypes: [ORKConsentSectionType] = [
.Overview,
.DataGathering,
.Privacy,
.DataUse,
.TimeCommitment,
.StudySurvey,
.StudyTasks,
.Withdrawing
]
let consentSections: [ORKConsentSection] = consentSectionTypes.map { contentSectionType in
let consentSection = ORKConsentSection(type: contentSectionType)
consentSection.summary = "If you wish to complete this study..."
consentSection.content = "In this study you will only be asked 10 easy question!!!"
return consentSection
}
consentDocument.sections = consentSections
// Getting Signature
consentDocument.addSignature(ORKConsentSignature(forPersonWithTitle: nil, dateFormatString: nil, identifier: "ConsentDocumentParticipantSignature"))
return consentDocument
}
的問題是,這個代碼創建一個相同的摘要和內容的每一頁。我如何爲每個單獨的部分創建單獨的頁面?
您可以使用一個開關塊地圖內,針對不同的'contentSectionType'分配不同的字符串。 – Yuan
@袁你能舉個例子嗎?我正在嘗試 ''開關consentSectionTypes案例consentSectionTypes.Overview: Overview.summary =「如果你想完成這項研究...」 Overview.content =「在這項研究中,你只會被問到10個簡單的問題! !!「 '' – Tendouji