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

UIKitのAPI Diffから見る Safe Area - iOS LT #32

6500a96a5f0786d7ff0c53429d691ae6?s=47 kazuhiro4949
October 26, 2017

UIKitのAPI Diffから見る Safe Area - iOS LT #32

Safe Area関連のAPIをUIKitから抽出してきたもの

6500a96a5f0786d7ff0c53429d691ae6?s=128

kazuhiro4949

October 26, 2017
Tweet

More Decks by kazuhiro4949

Other Decks in Technology

Transcript

  1. 6*,JUͷ"1*%J⒎͔ΒݟΔ 4BGF"SFB ,B[VIJSP)":"4)* J04-5

  2. 4BGF"SFBͱ͸ wJ04͔Βͷػೳ w7JFXͷத਎͕දࣔ͞ ΕΔ͜ͱΛอূͯ͠ ͍ΔྖҬ wJ1IPOF9Ͱ͸)PNF *OEJDBUPS΍4FOTPS )PVTJOHͱίϯςϯ π͕ඃΒͳ͍Α͏ʹ ઃఆ͞ΕΔ

    IUUQTEFWFMPQFSBQQMFDPNJPTIVNBOJOUFSGBDFHVJEFMJOFTPWFSWJFXJQIPOFY
  3. ΞδΣϯμ  6*,JUͷ4BGF"SFBؔ࿈ͷมߋΛௐࠪ͢Δ  ஋΍ΠϕϯτΛ࣮ࡍʹ৮ͬͯΈͯɺ4BGF"SFBͷϨΠΞ΢τ΁ ͷӨڹΛௐࠪ͢Δ

  4. ํ๏  6*,JU͕࣋ͭ"1*ͷJ04ʙJ04ؒͷ%J⒎Λ࢖͏  l4BGF"SFBl lMBZPVU.BSHJOl lJOTFUTlลΓͷΩʔϫʔυ Ͱԣஅతʹݕࡧ  υΩϡϝϯτ಺ʹ4BGF"SFBʹؔ͢Δهड़͕͋Ε͹ࢼͯ͠

    ΈΔ
  5. IUUQDPEFXPSLTIPQOFUPCKDEJ⒎TELEJ⒎TJPT

  6. 4BGF"SFBؔ࿈ͷ%J⒎ 6*7JFXTBGF"SFB*OTFUT 6*7JFXTBGF"SFB-BZPVU(VJEF 6*7JFXJOTFUT-BZPVU.BSHJO'PS4BGF"SFB 6*7JFXEJ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 ʹೖΔλΠϛϯάͰݺ͹ΕΔ w WJFX8JMM"QQFBSͷͱ͖ʹ͸·ͩ TBGF"SFB*OTFUTͷ஋͸ೖ͍ͬͯͳ ͍໛༷ WJFX8JMM"QQFBS @

    WJFX4BGF"SFB*OTFUT%JE$IBOHF VQEBUF7JFX$POTUSBJOUT WJFX8JMM-BZPVU4VCWJFXT
  25. 6*4DSPMM7JFX

  26. DPOUFOU*OTFU"EKVTUNFOU#FIBWJPS w 6*7JFX$POUSPMMFSͷBVUPNBUJDBMMZ"EKVTUT4DSPMM7JFX*OTFUTʹ୅ΘΔϓϩ ύςΟ w TBGF"SFBΛߟྀͯ͠DPOUFOU*OTFUT͕ࣗಈతʹηοτ͞ΕΔ w BVUPNBUJD TDSPMMBCMF"YFT OFWFS

    BMXBZTͷ̐ͭͷ஋ͷͲΕ͔ʹͳΔ w σϑΥϧτ͸BVUPNBUJD
  27. DPOUFOU*OTFU"EKVTUNFOU#FIBWJPS TDSPMM7JFXDPOUFOU*OTFU"EKVTUNFOU#FIBWJPSBMXBZT w6*4DSPMM7JFXͷதʹXJEUI͕ IFJHIU͕ͷ7JFX͕ೖ͍ͬͯΔ wDPOUFOU4J[F͸தʹஔ͍͍ͯΔ7JFXͱಉ͡αΠζͱ͢Δ ͭ·Γਨ௚ํ޲ͷΈεΫϩʔϧՄ  w-BOETDBQFͰਨ௚ํ޲΁Ұ൪Լ·ͰεΫϩʔϧͨ࣌͠ʹϚʔδϯ͕Ͳ͏ͳΔ͔ΛݟͯΈΔ ඞ্ͣԼࠨӈͷTBGF"SFB෼ͷϚʔδϯ͕ͭ͘

  28. DPOUFOU*OTFU"EKVTUNFOU#FIBWJPS TDSPMM7JFXDPOUFOU*OTFU"EKVTUNFOU#FIBWJPSOFWFS ඞͣTBGF"SFB͸ແࢹ͞ΕΔ w6*4DSPMM7JFXͷதʹXJEUI͕ IFJHIU͕ͷ7JFX͕ೖ͍ͬͯΔ wDPOUFOU4J[F͸தʹஔ͍͍ͯΔ7JFXͱಉ͡αΠζͱ͢Δ ͭ·Γਨ௚ํ޲ͷΈεΫϩʔϧՄ  w-BOETDBQFͰਨ௚ํ޲΁Ұ൪Լ·ͰεΫϩʔϧͨ࣌͠ʹϚʔδϯ͕Ͳ͏ͳΔ͔ΛݟͯΈΔ

  29. DPOUFOU*OTFU"EKVTUNFOU#FIBWJPS TDSPMM7JFXDPOUFOU*OTFU"EKVTUNFOU#FIBWJPSTDSPMMBCMF"YFT εΫϩʔϧՄೳͳྖҬ ͜͜Ͱ͸ਨ௚ํ޲ ͷΈʹϚʔδϯ͕ͭ͘ w6*4DSPMM7JFXͷதʹXJEUI͕ IFJHIU͕ͷ7JFX͕ೖ͍ͬͯΔ wDPOUFOU4J[F͸தʹஔ͍͍ͯΔ7JFXͱಉ͡αΠζͱ͢Δ ͭ·Γਨ௚ํ޲ͷΈεΫϩʔϧՄ 

    w-BOETDBQFͰਨ௚ํ޲΁Ұ൪Լ·ͰεΫϩʔϧͨ࣌͠ʹϚʔδϯ͕Ͳ͏ͳΔ͔ΛݟͯΈΔ
  30. DPOUFOU*OTFU"EKVTUNFOU#FIBWJPS TDSPMM7JFXDPOUFOU*OTFU"EKVTUNFOU#FIBWJPSBVUPNBUJD جຊతʹTDSPMMBCMF"YJTͱಉ͡ɻBVUPNBUJDBMMZ"EKVTUT4DSPMM7JFX*OTFUT͕USVFͳΒɺ εΫϩʔϧՄೳͰ͋Ζ͏ͱͳ͔Ζ͏ͱ/BWJHBUJPO$POUSPMMFSʹର͢Δ্෦Ϛʔδϯ͸ͭ͘ ޙํޓ׵ͷͨΊͷػೳ w6*4DSPMM7JFXͷதʹXJEUI͕ IFJHIU͕ͷ7JFX͕ೖ͍ͬͯΔ wDPOUFOU4J[F͸தʹஔ͍͍ͯΔ7JFXͱಉ͡αΠζͱ͢Δ ͭ·Γਨ௚ํ޲ͷΈεΫϩʔϧՄ 

    w-BOETDBQFͰਨ௚ํ޲΁Ұ൪Լ·ͰεΫϩʔϧͨ࣌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UT$POUFOU7JFXT5P4BGF"SFBUSVF

  37. 6*$PMMFDUJPO7JFX'MPX-BZPVU

  38. TFDUJPO*OTFU3FGFSFODF w 6*$PMMFDUJPO7JFX'MPX-BZPVUͷTFDUJPO*OTFUTʹରͯ͠ɺTBGF"SFB  -BZPVU.BSHJO $POUFOU*OTFUTͷͲΕΛߟྀͯ͠ઃఆ͢Δ͔ܾΊΒΕΔ w GSPN$POUFOU*OTFU GSPN4BGF"SFB GSPN-BZPVU.BSHJOTͷFOVNͰߏ

    ੒͞ΕΔ w σϑΥϧτ͸GSPN$POUFOU*OTFUͰɺTFDUJPO*OTFUT͸DPOUFOU*OTFUTͷӨ ڹΛड͚Δ
  39. TFDUJPO*OTFU3FGFSFODF JGMFUMBZPVUDPMMFDUJPO7JFXDPMMFDUJPO7JFX-BZPVUBT 6*$PMMFDUJPO7JFX'MPX-BZPVU\ MBZPVUTFDUJPO*OTFU3FGFSFODFʜ͜͜ͷ஋Λม͑Δ ^ GSPN$POUFOU*OTFU GSPN-BZPVU.BSHJOT GSPN4BGF"SFB

  40. ·ͱΊ w ҙ֎ͱ4BGF"SFBབྷΈͷ"1*%J⒎ଟ͔ͬͨ w ݩʑෳࡶͩͬͨϚʔδϯབྷΈͷϨΠΞ΢τ͕ߋʹෳࡶʹͳ͖͍ͬͯͯΔҹ৅ w υΩϡϝϯτΛಡΜͰ΋Կ͕ى͖Δͷ͔ΠϚΠν͔ͭΈʹ͘͘ɺ࣮ࡍʹಈ͔͠ ͯΈͳ͍ͱΘ͔Βͳ͔ͬͨ w ϓϩύςΟͷ஋Λมߋ͢ΔͱԿ͕ى͖Δͷ͔

    w ϥΠϑαΠΫϧ͸ͲͷλΠϛϯάͰಈ͍ͯɺ஋͕Ͳ͏มΘΔͷ͔
  41. αϯϓϧʹ࢖ͬͨΞϓϦ͸ ͪ͜Β΁ஔ͍͍ͯ·͢ IUUQTHJUIVCDPNLB[VIJSP4BGF"SFB4BNQMF

  42. ࢀߟࢿྉ w 6*,JU"QQMF%FWFMPQFS w IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOVJLJU w #VJMEJOH"QQTGPSJ1IPOF9 w IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZGBMM w

    %FTJHOJOHGPSJ1IPOF9 w IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZGBMM w 6QEBUJOH:PVS"QQGPSJ04 w IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED w 6*,JUJ04UP"1*%J⒎FSFODFT w IUUQDPEFXPSLTIPQOFUPCKDEJ⒎TELEJ⒎TJPT6*,JUIUNM