お手軽iPad対応

 お手軽iPad対応

6139fd48daa26e786794598c4a6b546a?s=128

ninjinkun

May 30, 2013
Tweet

Transcript

  1. ͓खܰiPadରԠ id:ninjinkun / @ninjinkun http://ninjinkun.hatenablog.com Thursday, May 30, 13

  2. ͓खܰiPadରԠ • ͓खܰʹ͢ΔͨΊͷલఏ • iOS͕༻ҙ͍ͯ͠ΔػೳΛ׆༻͢Δ • UI͸૊ΈࠐΈΫϥεΛத৺ͱͯ͠࡞Δ Thursday, May 30,

    13
  3. ΞδΣϯμ • ૊ΈࠐΈUIΫϥε • UIViewAutoresizing • UIView • Ϟʔμϧ •

    ϦιʔεϑΝΠϧ • ϨΠΞ΢τΫϥεͷ෼཭ • ճసରԠ Thursday, May 30, 13
  4. ૊ΈࠐΈUIΫϥε • ࣗಈతʹ৳ॖ͞ΕΔ • UINavigationController • UITabBarController • Viewͷத਎͸खಈͰ৳ॖ Thursday,

    May 30, 13
  5. UIViewAutoresizing • ਌Ϗϡʔʹର͢Δ্Լࠨӈἧ͑ɺॎԣ֦େΛఆٛ • ը໘͕޿͕ͬͯ΋ݩͷϨΠΞ΢τΛҡ࣋͢ΔΑ͏ʹ • Autolayout࢖͍͍͚ͨͲ… • iOS 6͔ΒͷΈରԠ

    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; Thursday, May 30, 13
  6. UIView • drawRect:ͰҰؾʹॻ͔ͳ͍ • ϏϡʔΛ෼ׂ͢Δ • UIImageView, UILabelʹཔΔ • UIViewࢠΫϥεͳΒ

    layoutSubviewsͰαΠζΛઃ ఆͯ͠΍Δ Thursday, May 30, 13
  7. Ϟʔμϧ • ModalΛશը໘Ͱग़͔͢αϒ΢Οϯυ΢ͱͯ͠ग़͔͢ • ౤ߘUIΈ͍ͨͳ΋ͷ͸αϒ΢Οϯυ΢Ͱ viewController.modalPresentationStyle = UIModalPresentationFormSheet; Thursday, May

    30, 13
  8. ϦιʔεϑΝΠϧ • .nib, .storyboard, .png • ~ipadΛ͚ͭͯ෼ذ • ࣗಈతʹ~ipad͕ϩʔυ͞ΕΔ Thursday,

    May 30, 13
  9. ϨΠΞ΢τΫϥεͷ෼཭ • ෳࡶͳϨΠΞ΢τʹ͸PositionΫϥεΛఆٛ • ViewͷϨΠΞ΢τ৘ใΛ෼཭ͨ͠Ϋϥε • CGRectΛͨ͘͞Μ࣋ͬͯΔ • ͜ͷΫϥεΛ෯Մมʹ͢Ε͹ରԠ׬ྃ @interface

    BookmarkEntryPosition : NSObject @property (nonatomic, assign) CGFloat cellHeight; @property (nonatomic, assign) CGRect titleRect; @property (nonatomic, readonly, assign) CGRect faviconRect; @property (nonatomic, assign) CGRect countRect; @property (nonatomic, assign) CGRect contentRect; @property (nonatomic, assign) CGRect imageRect; @property (nonatomic, assign) CGRect countLineRect; @property (nonatomic, strong) NSArray *favoriteRects; Thursday, May 30, 13
  10. ճసରԠ • iPadΞϓϦ͸ճస͠ͳ͍ͱϦδΣΫτ • UIViewAutoresizingͳͲͪΌΜͱ΍ͬͯΕ͹೉͘͠ͳ͍ • ճస࣌ʹlayoutSubviews͕ݺ͹ΕΔ • iOS 5ͱ6ͷࠩʹ஫ҙ

    • iOS 5ͳΒҎԼͰOK • ৄ͘͠͸ʮiOS 6 ͷAuto RotationʯΛࢀর -(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation { return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad; } Thursday, May 30, 13
  11. ·ͱΊ • iOSͷػೳʹཔΔ͜ͱͰίετʹiPadରԠͰ͖·͢ • ࠷ॳ͔ΒUIViewAutoresizing࢖༻ͷίʔυʹ͓ͯ͘͠ ͱྑ͍ • ϕετͰ͸ͳ͍͚Ͳ΍Βͳ͍ΑΓ·͠ Thursday, May

    30, 13