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

HBFav実装のこだわり #confwd

Naoya Ito
February 01, 2014

HBFav実装のこだわり #confwd

#confwd での LT の資料です

Naoya Ito

February 01, 2014
Tweet

More Decks by Naoya Ito

Other Decks in Technology

Transcript

  1. )#'BWͷ࣮૷ͷͩ͜ΘΓ
    !OBPZB@JUP

    $POGFSFODF8JUI%FWFMPQFST

    View full-size slide

  2. SFCVJMEGNޮՌ

    View full-size slide

  3. 3VCZ.PUJPOͰͰ͖ͯ·͢

    View full-size slide

  4. ͳΊΒ͔ͳλΠϜϥΠϯ

    View full-size slide

  5. ͳΊΒ͔ʹ͢ΔͨΊʹ
    •  6*5BCMF7JFXεΫϩʔϧ଎౓ͷ࠷దԽ
    •  5XJUUFSΈ͍ͨͳ6*5BCMF7JFXͷߋ৽
    •  ϦΞϧλΠϜ͡Όͳ͍΋ͷΛϦΞϧλΠϜ
    ͷΑ͏ʹݟͤΔ
    – J04ͷ3FNPUFOPUJpDBUJPOϞʔυ

    View full-size slide

  6. 6*5BCMF7JFXΛͳΊΒ͔ʹ
    ΋͸΍'"2Ͱ͕͢ŋŋŋ
    h"ps://blog.twi"er.com/2012/simple-­‐strategies-­‐smooth-­‐anima9on-­‐iphone

    View full-size slide

  7. ͓͓·͔ʹ
    •  ϦϞʔτͷϦιʔε͸ඇಉظͰऔಘ
    •  6TFEJSFDUESBXJOH
    – 1IBTF1JQFMJOFŋŋŋESBX3FDUͷதͰ
    ͸$16ˠ(16
    – ηϧͷதͰ͸6*-BCFM΍6**NBHF7JFXͳ
    Ͳͷ7JFXΛαϒϏϡʔͱͤͣɺ
    ESBX*O3FDUͳͲͰ௚઀ඳը͢Δ
    •  (16ॲཧ͕࢝·Δલͷ$16ෛ୲ΛݮΒ͢

    View full-size slide

  8. ϦϞʔτͷϦιʔε͸ඇಉظͰ
    •  ࢛ͷޒͷݴΘͣ"'/FUXPSLJOH
    •  setImageWithURLReqest:placeholderI
    mage:success:failure:
    ͍ͭ͜ʹ೚ͤΕ͹ྑ͍
    ײ͡Ͱඇಉظʹ

    View full-size slide

  9. %JSFDU%SBXJOH
    class  CustomCellContentView  <  UIView  
       def  drawRect(rect)  
           self.superview.superview.drawRectContent(rect)  
       end  
    end  
     
    class  BookmarkCell  <  UITableViewCell  
     
    def  initWithStyle(style,  reuseIdentifier:reuseIdentifier)  
       if  super  
           @contentView  =  CustomCellContentView.alloc.initWithFrame(CGRectZero)  
           ...  
    end  
     
    def  drawRectContent(rect)  
       ...  
       font  =  UIFront.boldSystemFontOfSize(16)  
       size  =  @text.sizeWithFont(font)  
       @text.drawInRect([[x,  y],  size],  withFont:font)  
    end  
    DPOUFOU7JFXͷ
    ESBX3FDU಺Ͱ
    ESBX*O3FDUͰඳը

    View full-size slide

  10. 5XJUUFSΈ͍ͨͳߋ৽
    εΫϩʔϧͰ৽͠
    ͍ηϧ͕Ͱͯ͘Δ
    5XJUUFSΞϓϦ͸
    ৽ண͕͋Δͱŋŋŋ
    6*3FGSFTI$POUSPMΛී௨ʹ࢖͚ͬͨͩͰ͸͜ͷಈ͖ʹͳΒͳ͍

    View full-size slide

  11. DPOUFOU0GGTFUΛҡ࣋͢Δ
    offset  =  tableView.contentOffset  
    tableView.reloadData  
     
    for  i  in  (0..prependedRowSize  -­‐  1)  do  
       offset.y  +=  self.tableView(  
           tableView,  
           heightForRowAtIndexPath:NSIndexPath.indexPathForRow(i,  inSection:0)  
       )  
    end  
     
    if  offset.y  >  tableView.contentSize.height  
       offset.y  =  0  
    end  
     
    tableView.setContentOffset(offset)  
    SFMPBEલͷ
    DPOUFOU0⒎TFU
    Λऔಘ
    ௥Ճͨ͠ηϧͷ
    ߴ͞Λܭࢉ
    ࠶ܭࢉͨ͠
    P⒎TFUΛηοτ
    ͜ΕΛϞσϧߋ৽ͷΠϕϯτΛड͚औͬͨ࣌ʹ࣮ߦ͢Δ
    ΋͏ͪΐͬͱ଎͍࣮૷͕͋Γͦ͏ͳ͖΋͢Δ͚Ͳ

    View full-size slide

  12. ϦΞϧλΠϜͷΑ͏ʹݟͤΔ
    •  )#'BWͷσʔλݩ͸͸ͯͳϒοΫϚʔΫ
    ͷ344ϑΟʔυ
    •  344औಘΛϢʔβʔʹҙࣝͤ͞ͳ͍
    – ͸ͯͳϒοΫϚʔΫͷ8FC)PPLΛ࢖͍ɺ
    ৽ண͕͋ͬͨΒ୺຤ʹ3FNPUF1VTI
    – J04ͷ3FNPUFOPUJpDBUJPOܖػͰ
    344ΛऔΓʹ͍͖ɺ5BCMF7JFXΛߋ৽ͯ͠
    ͓͘

    View full-size slide

  13. ͸ͯͳϒοΫϚʔΫ
    QVTIICGBWDPN
    1BSTF .#BB4

    "1/αʔόʔ
    ৽ணΠϕϯτΛ
    8FC)PPLͰ
    .#BB4ܦ༝Ͱ
    QVTI͕ಧ͘
    344ΛऔΔ
    ΞϓϦΛ։͍ͨΒ΋͏৽ணσʔλ͕͋Δ

    View full-size slide

  14. BQQMJDBUJPOEJE3FDFJWF3FNPUF/PUJpDB
    UJPOGFUDI$PNQMFUJPO)BOEMFS
    def  application(application,  didReceiveRemoteNotification:userInfo,  
    fetchCompletionHandler:completionHandler)  
       self.timelineViewController.performBackgroundFetchWithCompletion(  
           completionHandler  
       )  
       self.handlePush(application,  userInfo:userInfo)  
    end  
    J04͔Βɺ#BDLHSPVOE.PEFTͷ
    SFNPUFOPUJpDBUJPOTΛ༗ޮʹ͢Δ
    ͱɺQVTIܖػͰ͜ͷϋϯυϥ͕ݺ͹
    ΕΔ

    View full-size slide

  15. ͓΋͠ΖϙΠϯτ
    •  3VCZ.PUJPOಛ༗ͷ࿩͸͍ͯ͠ͳ͍
    – ҰൠతͳJ04ϓϩάϥϛϯάͷϊ΢ϋ΢ͦͷ
    ··
    – ͭ·Γɺ3VCZ.PUJPOͰͰ͖Δ͜ͱ͸
    0CKFDUJWF$ͷͦΕͱมΘΒͳ͍

    View full-size slide

  16. 3VCZ.PUJPO͸ݴޠ͚͕ͩSVCZͰଞ͸શ෦Ұॹ

    View full-size slide

  17. ·ͱΊ
    •  )#'BW࢖ͬͯͳ͍΍ͭ͸৘ऑ
    冗談です。  
    使ってね☆

    View full-size slide

  18. ͪͳΈʹ
    •  HJUIVCOBPZB)#'BWʹιʔε͋Γ·
    ͢ Ԛ͍͚Ͳ

    View full-size slide

  19. ͪͳΈʹςετ͸͋Γ·ͤΜ

    View full-size slide

  20. ͢͜͠એ఻
    •  ༝ॹਖ਼͍͠
    #$ϝσΟΞܥͷJ04ΞϓϦ
    ࡞Δ͓࢓ࣄ͋Γ·͢ɻڵຯ͋Δํ PSձ

    ɺ͓੠͕͚͍ͩ͘͞
    •  ,"*;&/QMBUGPSN*ODͱ͍͏ձࣾͰ
    SVCZͰ͖Δਓืूͯ͠·͢

    View full-size slide