我正在做这个代码,并坚持使pdf与调查结果。谁能帮忙把调查任务的结果做成pdf文件?提前谢谢。
func taskViewController(taskViewController: ORKTaskViewController,
didFinishWithReason reason: ORKTaskViewControllerFinishReason,
error: NSError?) {
let taskResult = taskViewController.result
if reason == ORKTaskViewControllerFinishReason.Completed
{
// var data = NSKeyedArchiver.archivedDataWithRootObject(taskViewController.result)
//here how can i get the text of steps and results?
NSUserDefaults.standardUserDefaults().setBool(true, forKey: kSurveyCompleted)
NSUserDefaults.standardUserDefaults().synchronize()
}
if reason == ORKTaskViewControllerFinishReason.Discarded
{
NSUserDefaults.standardUserDefaults().setBool(false, forKey: kSurveyCompleted)
NSUserDefaults.standardUserDefaults().synchronize()
}
}
你可以这样使用pdf库:https://github.com/techprimate/TPPDF很容易在PDF中创建一个表,并用字段/值行填充它。如果你用的是iOS 11,里面有PDFKit