Upgrade to Pro — share decks privately, control downloads, hide ads and more …

文字列をコピーできるスクリーンショットを作る/iOSDC 2020 LT PDF

M"e
September 20, 2020

文字列をコピーできるスクリーンショットを作る/iOSDC 2020 LT PDF

M"e

September 20, 2020
Tweet

More Decks by M"e

Other Decks in Technology

Transcript

  1. © ZOZO Technologies, Inc. 13 ࠓ೔࿩͞ͳ͍͜ͱ - ϑϧϖʔδͷεΫϦʔϯγϣοτͷ࡞੒ʹ͍ͭͯ - TECH

    BLOGʹ౤ߘ͍ͯ͠·͢ https://techblog.zozo.com/entry/ios_fullpage_screenshot
  2. © ZOZO Technologies, Inc. iOSͷඳըʹ͍ͭͯ 25 - iOS͸contextʹΑͬͯඳըܗ͕ࣜมΘΔ - PDFContext

    → PDF - ImageContext → ը૾ https://developer.apple.com/library/archive/documentation/ GraphicsImaging/Conceptual/drawingwithquartz2d/dq_overview/ dq_overview.html
  3. © ZOZO Technologies, Inc. 27 let renderer = UIGraphicsPDFRenderer(bounds: view.bounds)

    let data = renderer.pdfData { context in context.beginPage() view.layer.render(in: context.cgContext) } UIGraphicsEndPDFContext() ίʔυΛݟ௚ͯ͠ΈΔ
  4. © ZOZO Technologies, Inc. 28 let renderer = UIGraphicsPDFRenderer(bounds: view.bounds)

    let data = renderer.pdfData { context in context.beginPage() view.layer.render(in: context.cgContext) } UIGraphicsEndPDFContext() ίʔυΛݟ௚ͯ͠ΈΔ ո͍͠
  5. © ZOZO Technologies, Inc. 34 UIView CALayer PDFContext drawRect render

    ίϐʔͰ͖ͳ͍ PDF BitmapContext ϏοτϚοϓ PDFContext ίϐʔͰ͖Δ PDF viewΛඳը͢Δ
  6. © ZOZO Technologies, Inc. 35 let renderer = UIGraphicsPDFRenderer(bounds: view.bounds)

    let data = renderer.pdfData { context in context.beginPage() view.layer.render(in: context.cgContext) } UIGraphicsEndPDFContext() viewΛඳը͢Δ
  7. © ZOZO Technologies, Inc. 36 let renderer = UIGraphicsPDFRenderer(bounds: view.bounds)

    let data = renderer.pdfData { context in context.beginPage() view.draw(view.bounds) } UIGraphicsEndPDFContext() viewΛඳը͢Δ
  8. © ZOZO Technologies, Inc. 39 let renderer = UIGraphicsPDFRenderer(bounds: view.bounds)

    let data = renderer.pdfData { context in context.beginPage() view.draw(view.bounds) } UIGraphicsEndPDFContext() viewΛඳը͢Δ
  9. © ZOZO Technologies, Inc. 40 let renderer = UIGraphicsPDFRenderer(bounds: view.bounds)

    let data = renderer.pdfData { context in context.beginPage() view.subviews.forEach { $0.draw($0.bounds) } } UIGraphicsEndPDFContext() viewΛඳը͢Δ