Slide 1

Slide 1 text

Good Practices for a Robust View Layout 2018.9.2

Slide 2

Slide 2 text

1. ϨΠΞ΢τ͸ͳͥյΕΔͷ͔ 2. ໰୊ʹରॲ͢ΔͨΊͷಓ۩ 2.1.Auto Layout 2.2.Storyboard 2.3.ϥΠϒϨϯμϦϯά 3. UIίϯϙʔωϯτΛςετ͢Δ Agenda

Slide 3

Slide 3 text

What is a broken layout?

Slide 4

Slide 4 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 5

Slide 5 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 6

Slide 6 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 7

Slide 7 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 8

Slide 8 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 9

Slide 9 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 10

Slide 10 text

ϨΠΞ΢τ͕յΕ͍ͯΔ ͜ͱʹؾͮ͘͜ͱ͸೉͍͠

Slide 11

Slide 11 text

- ಛఆͷঢ়ଶͷͱ͖͚ͩى͜Δ - ϩάΠϯɾະϩάΠϯͰදࣔ಺༰͕มΘΔ - λοϓ΍εϫΠϓͷΞΫγϣϯͰը໘͕มΘΔ - σʔλͷྔʹΑΔ - ͞·͟·ͳΤϥʔ - ਖ਼͠͞ͷఆ͕ٛ೉͍͠ - Ϋϥογϡ͢ΔΘ͚Ͱ͸ͳ͍ - ίϯϐϡʔλ͕ؒҧ͍Λ൑அͰ͖ͳ͍ ͳͥյΕ͍ͯΔ͜ͱʹؾ͚ͮͳ͍͔

Slide 12

Slide 12 text

ؾͮ͘͜ͱ͕Ͱ͖ͯ΋ ๷͙͜ͱ͸͞Βʹ೉͍͠

Slide 13

Slide 13 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 14

Slide 14 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 15

Slide 15 text

What is the problem?

Slide 16

Slide 16 text

- ঢ়ଶ͕ଟ͍ - μΠφϛοΫʹมԽ͢Δ - ࣮ߦ͢Δ·ͰΘ͔Βͳ͍ What is the problem

Slide 17

Slide 17 text

- ঢ়ଶΛݮΒ͠ - ੩తʹఆٛ͠ - ࣮ߦͤͣʹ֬ೝ͢Δ ໰୊Λখ͘͢͞Δ

Slide 18

Slide 18 text

ಉ͡΋ͷΛ࡞Δํ๏͕ ৗʹෳ਺ଘࡏ͢Δ ѱ͍΍ΓํΛݮΒ͠ɺྑ͍΍ΓํΛ૿΍͢

Slide 19

Slide 19 text

(00% #"% 5FTUBCMF %FDMBSBUJWF 4UBUJD %ZOBNJD 4NBMM4JNQMF -BSHF$PNQMFY 'SBNF-BZPVU "VUP-BZPVU 9*#4UPSZCPBSE *OUFSGBDF#VJMEFS .BOVBM5FTU 6*4UBDL7JFX

Slide 20

Slide 20 text

Ξϯνύλʔϯ

Slide 21

Slide 21 text

- σόΠεΛ൑ఆ͢Δ - ඪ४UIͷαΠζΛԾఆ͢Δ Ξϯνύλʔϯ

Slide 22

Slide 22 text

σόΠεΛ൑ఆ͢Δ

Slide 23

Slide 23 text

σόΠεΛ൑ఆ͢Δ !

Slide 24

Slide 24 text

- ৚݅Λ૿΍ͯ͠͸͍͚ͳ͍ - if isIPhoneX { ͱॻ͍ͨͳΒɺiPhone Xͱͦ ΕҎ֎ͷσόΠεͰඞͣ֬ೝ͠ͳ͚Ε͹ͳΒͳ ͘ͳΔ - ৽͍͠σόΠε͕ൃച͞ΕͨΒʁ - ܧଓՄೳͳ࢓૊ΈͰ͸ͳ͍ σόΠεΛ൑ఆͯ͠͸͍͚ͳ͍!

Slide 25

Slide 25 text

ඪ४UIͷαΠζΛԾఆ͢Δ

Slide 26

Slide 26 text

ඪ४UIͷαΠζΛԾఆ͢Δ !

Slide 27

Slide 27 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 28

Slide 28 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 29

Slide 29 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 30

Slide 30 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 31

Slide 31 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 32

Slide 32 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 33

Slide 33 text

- ඪ४UIͷαΠζ͸ݻఆͰ͸ͳ͍ - ࣮ߦ࣌ʹมΘΔ - มΘΒͳ͍ͱࢥ͍ͬͯΔ΋ͷ΋ҙ֎ͱมΘΔ - έʔεΛ໢ཏ͢Δ͜ͱ͕ࠔ೉ ඪ४UIͷαΠζΛԾఆͯ͠͸͍͚ͳ͍!

Slide 34

Slide 34 text

Safe Area (Top/Bottom Layout Guide)͔Β૬ରతʹߟ͑Δ

Slide 35

Slide 35 text

Safe Area (Top/Bottom Layout Guide)͔Β૬ରతʹߟ͑Δ

Slide 36

Slide 36 text

Safe Area (Top/Bottom Layout Guide)͔Β૬ରతʹߟ͑Δ - Safe Areaʹ෇͚Δ͔ͦ͏Ͱͳ͍ͷ͔ - جຊతʹ͜Ε͚ͩ - ͜ΕΛͦΕͧΕͷϏϡʔͰ൑அ͢Δ

Slide 37

Slide 37 text

Good/Bad Practice

Slide 38

Slide 38 text

- AutoLayout - Storyboard ໰୊ʹରॲ͢ΔͨΊͷπʔϧ

Slide 39

Slide 39 text

Frame LayoutΑΓ Auto Layout

Slide 40

Slide 40 text

- Auto Layout GOOD - Frame Layout BAD

Slide 41

Slide 41 text

- Auto Layout (or Alt-Auto Layout) GOOD - Frame Layout BAD

Slide 42

Slide 42 text

Storyboard (Interface Builder)Λ ׆༻͢Δ

Slide 43

Slide 43 text

Good

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

- Interface BuilderΛ׆༻͢Δ - Auto LayoutͷΤϥʔΛڭ͑ͯ͘ΕΔ - ࣮ߦͤͣʹ͞·͟·ͳঢ়ଶΛ֬ೝͰ͖Δ - @IBDesignable/@IBInspectable͕ศར Good Practice

Slide 48

Slide 48 text

Auto Layoutͷ੍໿Λ Storyboard/XIBͰ࡞੒͢Δ

Slide 49

Slide 49 text

Auto Layoutͷ੍໿Λ Storyboard/XIBͰ࡞੒͢Δ

Slide 50

Slide 50 text

ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 51

Slide 51 text

Q. Auto Layoutͷ੍໿Λ ίʔυͰॻ͘͜ͱͷԿ͕೉͍͠ͷ͔

Slide 52

Slide 52 text

A. ੍໿͕૬ޓʹӨڹ͢ΔͨΊ

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

4T

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

- ೴಺ϝϞϦ͕଍Γͳ͘ͳΔ ίʔυͰॻ͘ΑΓStoryboard

Slide 71

Slide 71 text

એݴతʹهड़͢Δ

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

Use UIStackView

Slide 76

Slide 76 text

Use UIStackView

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

τϧπϝ͸UIStackView - ͢΂ͯͷϏϡʔΛUIStackViewʹ٧Ίͯɺ isHiddenΛ੾Γସ͑Δ͚ͩ - Ϛʔδϯ͕ҰఆͰͳ͍৔߹͸ϚʔδϯΛ࣋ͭϏϡʔ Λ֎ଆʹ࣋ͭ

Slide 80

Slide 80 text

ࣅͨΑ͏ͳϏϡʔͰ߲໨ͷ૿ݮ͕͋Δͱ͖

Slide 81

Slide 81 text

ࣅͨΑ͏ͳϏϡʔͰ߲໨ͷ૿ݮ͕͋Δͱ͖

Slide 82

Slide 82 text

Paging /w UIScrollView ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 83

Slide 83 text

UICollection/TableView vs UIStackView ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 84

Slide 84 text

Animation ը૾ɾσʔλ౳͸ٕज़આ໌ͷͨΊͷαϯϓϧͰ͢ɻ

Slide 85

Slide 85 text

ΞχϝʔγϣϯʹΑΔϨΠΞ΢τ΁ͷӨڹ - ΞχϝʔγϣϯʹΑͬͯผͷϏϡʔͷҐஔΛม͑ Δ͔Ͳ͏͔ʢྫ: ԡ͠ग़͢ʣ - ผͷϏϡʔΛԡ͠ग़ͨ͠Γ͠ͳ͍ͳΒɺ CGAffineTransform͕࢖͑Δ

Slide 86

Slide 86 text

CGAffineTransformʹΑΔΞχϝʔγϣϯ

Slide 87

Slide 87 text

CGAffineTransformʹΑΔΞχϝʔγϣϯ

Slide 88

Slide 88 text

ಈతͳ಺༰Λ੩తʹఆٛ͢Δ - UIStackViewΛ׆༻͢Δ - τϧπϝ - ߲໨ͷ૿ݮ - εΫϩʔϧ/ϖʔδϯά - CGAffineTransformʹΑΔΞχϝʔγϣϯ

Slide 89

Slide 89 text

- Auto Layout͸ίʔυͰॻ͘ΑΓStoryboard/XIB - ঢ়ଶΛݮΒ͢ - ੩తʹఆٛ͢Δ - ಈతʹ੍໿Λมߋ͠ͳ͍ Good Practice

Slide 90

Slide 90 text

Grouping

Slide 91

Slide 91 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 92

Slide 92 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 93

Slide 93 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 94

Slide 94 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 95

Slide 95 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 96

Slide 96 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 97

Slide 97 text

άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 98

Slide 98 text

- ෼ׂ౷࣏ - ৗʹ̎ͭͷϏϡʔͱSuper Viewͷؔ܎ͱͯ͠ߟ͑ ΒΕΔ - ΍Γ͗͢͸ې෺ʢ೴಺ϝϞϦ͕଍Γͳ͘ͳΔʣ άϧʔϐϯά͢Δͱ੍໿ͷؔ܎͕؆୯ʹͳΔ

Slide 99

Slide 99 text

ύϑΥʔϚϯε͕ؾʹͳΔʁ

Slide 100

Slide 100 text

- ྆ํΛ༏ઌ͢Δ͜ͱ͸Ͱ͖ͳ͍ - ઈରతͳਖ਼ղ͸ͳ͍ - ৗʹܭଌ͢΂͠ - ຊ౰ʹ໰୊ʹͳΔͱ͜Ζ͚ͩ - ηΦϦʔͱͯ͠ɺಡΈ΍͢͞Λ༏ઌ͢Δ ύϑΥʔϚϯεͷ໰୊͸ৗʹτϨʔυΦϑ

Slide 101

Slide 101 text

- Best Practice!! - ςελϒϧʹ͢Δʹґଘ͕গͳ͘ͳΔɺ໰୊͕খ ͘͞ͳΔɺetc - ݸʑͷίϯϙʔωϯτ͕ਖ਼͚͠Ε͹શମ͕ਖ਼͍͠ ֬཰͕ߴ͍ ςελϒϧʹ͢Δ

Slide 102

Slide 102 text

Folio UI Collection https://github.com/folio-sec/Folio-UI-Collection

Slide 103

Slide 103 text

Folio UI Collection $POUBJOFE#VUUPO 0VUMJOFE#VUUPO 5FYU#VUUPO 5BH-BCFM $POUBJOFS-BCFM 4VCNJTTJPO4UBUVT#VUUPO https://github.com/folio-sec/Folio-UI-Collection

Slide 104

Slide 104 text

- ঢ়ଶΛݮΒ͢ - ੩తʹఆٛ͢Δ - ࣮ߦͤͣʹ֬ೝ͢ΔखஈΛ૿΍͢ - ςελϒϧΛ໨ࢦ͢ Summary

Slide 105

Slide 105 text

No content