首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在ResearchKit上创建个人同意页面?

如何在ResearchKit上创建个人同意页面?
EN

Stack Overflow用户
提问于 2015-11-28 07:38:35
回答 1查看 315关注 0票数 1

我在iPhone iOS 9.1上的Swift上使用Xcode 7.1.1编码和ResearchKit。我正在尝试创建同意页面,并一直在网上寻找没有成功的例子。

http://www.raywenderlich.com/104575/researchkit-tutorial-with-swift中,我得到了代码:

代码语言:javascript
复制
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
}

问题是,这段代码创建的每个页面都具有相同的摘要和内容。如何为每个单独的部分创建单独的页面??

EN

回答 1

Stack Overflow用户

发布于 2016-01-02 08:59:19

按照袁亚非的建议,替换你的地图函数如下:

代码语言:javascript
复制
 let consentSections: [ORKConsentSection] = consentSectionTypes.map { contentSectionType in
    let consentSection = ORKConsentSection(type: contentSectionType)
    switch contentSectionType {
    case .Overview:
        consentSection.summary = "Overview"
        consentSection.content = "Overview - Content"
    case .DataGathering:
        consentSection.summary = "DataGathering"
        consentSection.content = "DataGathering - Content"
    case .Privacy:
        consentSection.summary = "Privacy"
        consentSection.content = "Privacy - Content"
    case .DataUse:
        consentSection.summary = "DataUse"
        consentSection.content = "DataUse - Content"
    case .TimeCommitment:
        consentSection.summary = "TimeCommitment"
        consentSection.content = "TimeCommitment - Content"
    case .StudySurvey:
        consentSection.summary = "StudySurvey"
        consentSection.content = "StudySurvey - Content"
    case .StudyTasks:
        consentSection.summary = "StudyTasks"
        consentSection.content = "StudyTasks - Content"
    case .Withdrawing:
        consentSection.summary = "Withdrawing"
        consentSection.content = "Withdrawing - Content"
    default:
        break
   }
   return consentSection
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33966068

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档