[Online] potatotips #73 iOS/Android開発Tips共有会 https://potatotips.connpass.com/event/202810/
iOSΞϓϦͰLine HeightΛ ઃఆ͢Δͱ͖ʹҙ͍ͨ͜͠ͱגࣜձࣾϛΫγΟ ΈͯͶࣄۀ෦ϩΫωϜ @_rockname
View Slide
mixi, Inc.ࣗݾհϩΫωϜ / rockname• ϛΫγΟͰʮՈΞϧόϜΈͯͶʯͱ͍͏ΞϓϦΛ ։ൃͯ͠Δ• iOSϝΠϯɺAndroid, RailsͳͲॻ͍ͯΔ• εϚϒϥ͕͖
mixi, Inc.iOSΞϓϦͰςΩετʹLine HeightΛઃఆ͍ͨ͠• Line HeghitʹԿઃఆ͠ͳ͔ͬͨ߹ ӈਤͷΑ͏ʹځ۶ͳҹΛ༩͑ͯ͠·͏• ߦؒʹదͳεϖʔεΛ࣋ͨͤͯίϯςϯπΛ ಡΈ͘͢ද͍ࣔͨ͠
mixi, Inc.Line HeightͷఆٛLine Height(Leading) = ֤ߦͷBaselineؒͷେ͖͞https://material.io/design/typography/understanding-typography.html#type-properties
mixi, Inc.NSParagraphStyle > lineSpacing• iOSͰߦؒΛࢦఆ͍ͨ͠߹ͪ͜ΒΛ͏• lineSpacingΛઃఆͨ͠NSParagraphStyleΛ NSAttributedStringʹՃ͢Δ
mixi, Inc.
mixi, Inc.Line HeightΛઃఆ• fontSize: 25pt ʹରͯ͠ lineSpacing: 5pt Λઃఆ (Line Height͕30ʹͳΔ͜ͱΛظ)
mixi, Inc.దͳ͕ઃఆ͞Ε͍ͯΔ͔Λ֬ೝ• ظͷ30ptʹରͯ͠5ptେ͖͍Line Height• ఆҎ্ͷεϖʔε͕ઃఆ͞Εͯ͠·͍ͬͯͨ
mixi, Inc.UIFont > lineHeight• UIFontʹσϑΥϧτͰlineHeight͕ઃఆ͞Ε͍ͯΔ• ͜ͷΛߟྀͯ͠NSAttributedStringʹlineSpacing Λઃఆ͢Δඞཁ͕͋ͬͨ
mixi, Inc.దͳ͕ઃఆ͞Ε͍ͯΔ͔Λ֬ೝ• UIFont.font.pointSizeͱUIFont.lineHeightͱ NSParagraphStyle.lineSpacing ӈਤͷΑ͏ͳؔ• ͭ·ΓɺҎԼͷΑ͏ͳ͕ࣜΓཱͭ lineSpacing = ఆ͢Δߦؒ - (lineHeight - fontSize)
mixi, Inc.దͳ͕ઃఆ͞Ε͍ͯΔ͔Λ֬ೝ• ఆ௨Γ30ptͷLine HeightΛઃఆͰ͖͍ͯΔ
mixi, Inc.[Practice] Line HeightΛTypographyͱ࿈ಈ͢ΔΑ͏ఆٛ
Thank you!!!