Session3 Developing an Ios Prototype

download Session3 Developing an Ios Prototype

of 78

Transcript of Session3 Developing an Ios Prototype

  • 8/3/2019 Session3 Developing an Ios Prototype

    1/78

    Interac(onDesignforMobileDevices

    Session3,DevelopinganiOSPrototype

    DavidLamas,IlyaShmorgun

    TallinnUniversity,2012

  • 8/3/2019 Session3 Developing an Ios Prototype

    2/78

    DevelopinganiOSPrototype

    Crea(ngasingleviewapplica(on GeHngfamiliarwithXcode DesigningviewsinXcode ManagingUIViewControllersubclasses ManagingIBAc(onsandmethods Tes(ngyoursingleviewapplica(on

    Crea(ngatabbedapplica(on Managinggroupsintheprojecthierarchy Customizingatabbedapplica(on Tes(ngyourtabbedapplica(on

    January, 2012 2Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    3/78

    Crea(ngaSingleView

    Applica(on

    January, 2012 3Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    4/78

    Crea(ngaSingleView

    Applica(on OpenXcode. FromthemenuselectFile>New>New

    Project.

    January, 2012 4Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    5/78

    January, 2012 5Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    6/78

    Crea(ngaSingleView

    Applica(on FromthemenuselectSingleView

    Applica6on.

    ClicktheNextbuon.

    January, 2012 6Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    7/78

    January, 2012 7Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    8/78

    Crea(ngaSingleView

    Applica(on Specifythenameofyourproject. MakesurethatiPhoneisselectedasdevicefamily. MakesurethatUseStoryboardandUseAutoma6cReferenceCoun6ngareselected. Selectaloca(onforyourprojecttobesavedandclickCreate.

    January, 2012 8Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    9/78

    January, 2012 9Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    10/78

    GeHngFamiliarwithXcode

    January, 2012 10Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    11/78

    GeHngFamiliarwithXcode

    ThewindowofXcodeconsistsofseveralparts. ThetopofthewindowiscalledtheToolbar.Onthe

    leofthetoolbararecontrolsforstar(ngand

    stoppingtheproject.

    Apopupmenuenablesselec(onoftheschemeyouwanttorun,suchasaniOSdevice,aniPadoran

    iPhonesimulator.

    January, 2012 11Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    12/78

    GeHngFamiliarwithXcode

    ThebigblueboxinthemiddleofthetoolbaristheAc6vityviewwhichdisplaysac(onsandprocessesthatarecurrentlyhappening.

    OntherightsideofthetoolbararethreesetsofbuonsforSwitchingbetweenvariousconfigura(onsofthe

    Editor

    ShowingorhidingspecificpanesintheworkspaceShowingtheOrganizerwindowwhichamongotherthingsisusedasadocumenta(onviewerandaplacetomanageiOSdeviceswhicharesynchronizedwiththepar(cularcomputer.

    January, 2012 12Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    13/78

    GeHngFamiliarwithXcode

    BelowthetoolbaristheJumpbarwhichallowsjumpingtospecificelementsintheprojecthierarchy.

    InthemiddleofthewindowistheEditorwhichenablesedi(ngofcodeanduserinterfaceelements.

    BelowtheeditoristheDebugbarwheredebuggingerrorsaredisplayedduringthetes(ngoftheapplica(on.

    January, 2012 13Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    14/78

    GeHngFamiliarwithXcode

    OnthelesideofthewindowistheNaviga6onareawhichallowstheuserto

    navigatetheprojectstructure.

    OntherightsideofthewindowistheU6lityareawhichholdsthevarious

    inspectorsandlibrariesoffiletemplates,

    codesnippetsanduserinterfaceobjects.

    January, 2012 14Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    15/78

    January, 2012 15Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    16/78

    GeHngFamiliarwithXcode

    Onceyourprojectisloadedyouwillseeawindowshowingasummaryoftheprojects

    seHngs.

    Fromthisviewyouwillbeableamongotherthingstospecifysupporteddevicesand

    orienta(onsaswellasaddiconsandlaunch

    images.

    January, 2012 16Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    17/78

    January, 2012 17Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    18/78

    DesigningViewsinXcode

    January, 2012 18Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    19/78

    DesigningViewsinXcode

    FromtheProjectnavigatorselecttheMainstoryboard.storyboardfiletodisplay

    thecanvasofyourmainstoryboard.

    Astoryboardallowsyoutographicallyarrangeandmanageviewsofyour

    applica(ononasinglecanvasaswellas

    defineanapplica(onflowandassigntransi(onanima(ons.

    January, 2012 19Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    20/78

    January, 2012 20Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    21/78

    DesigningViewsinXcode

    Onthestoryboardyouwillseeaviewthatisgeneratedautoma(cally.

    SelectaViewControllerfromtheObjectlibraryanddragitontothecanvas.

    January, 2012 21Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    22/78

    January, 2012 22Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    23/78

    DesigningViewsinXcode

    DragalabelfromtheObjectlibraryandposi(onitonthefirstview.

    ChangethetextofthelabeltoViewOne. RepeatthesamestepsforthesecondviewandchangethetextofthelabeltoView

    Two.

    January, 2012 23Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    24/78

    January, 2012 24Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    25/78

    DesigningViewsinXcode

    DragtwoRoundedRectBuonsontothefirstviewandchangetheirtexttoInfoand

    SwitchView.

    Repeatthesamestepsforthesecondview.

    January, 2012 25Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    26/78

    January, 2012 26Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    27/78

    DesigningViewsinXcode

    ThenextstepwillbetolinkaSwitchViewbuontothesecondview.Thatwaywhenthebuonispressedthe

    secondviewwillbedisplayed.

    SelecttheSwitchViewbuoninthefirstviewanddoacontrol+click+dragtodragabluelinetothesecondview. Ifeverythingwasdonecorrectlyamenu(tledStoryboard

    Seguesshouldappear.

    SelectModalfromthelistofmenuop(ons.

    January, 2012 27Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    28/78

    January, 2012 28Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    29/78

    DesigningViewsinXcode

    RepeatthesamestepsfortheSwitchViewbuononthesecondview.

    Asaresultsbothviewsshouldbeconnectedtoeachother.

    January, 2012 29Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    30/78

    January, 2012 30Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    31/78

    DesigningViewsinXcode

    Clickonthetransi(onarrow. TheAtributesinspectorshouldopenshowingseHngsfortheStoryboardSegue.

    FromtheTransi6ondropdownmenuselectFlipHorizontal.

    Repeatthesamestepsforthesecondtransi(on.

    January, 2012 31Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    32/78

    January, 2012 32Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    33/78

    ManagingUIViewController

    Subclasses

    January, 2012 33Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    34/78

    ManagingUIViewController

    Subclasses GotoFile>New>NewFile. SelectaUIViewControllersubclassandclicktheNextbuon.

    January, 2012 34Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    35/78

    January, 2012 35Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    36/78

    ManagingUIViewController

    Subclasses NamethenewfileSecondViewController. MakesuretheTargetedforiPadandWith

    XIBforuserinterfaceop(onsare

    unchecked.

    ClicktheNextbuonandcreatethenewfile.

    January, 2012 36Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    37/78

    January, 2012 37Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    38/78

    ManagingUIViewController

    Subclasses Openthestoryboard. Selectthesecondviewcontroller.OpentheIden6tyinspectorandselectSecondViewControllerfromtheClassdrop

    downmenu.

    January, 2012 38Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    39/78

    January, 2012 39Tallinn University

    M i IBA ( d

  • 8/3/2019 Session3 Developing an Ios Prototype

    40/78

    ManagingIBAc(onsand

    Methods

    January, 2012 40Tallinn University

    M i IBA ( d

  • 8/3/2019 Session3 Developing an Ios Prototype

    41/78

    ManagingIBAc(onsand

    Methods OpentheViewController.hfile. AddalineofcodewhichwilleventuallybeusedtoassociateamethodcalledpageInfo

    withtheac(onoftheuserpressingtheInfo

    buonintheuserinterface.

    January, 2012 41Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    42/78

    January, 2012 42Tallinn University

    M i IBA ( d

  • 8/3/2019 Session3 Developing an Ios Prototype

    43/78

    ManagingIBAc(onsand

    Methods OpentheViewController.mfile. AddablockofcodeforthepageInfomethodbellowthe#pragmamark-View

    lifecycle.

    January, 2012 43Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    44/78

    January, 2012 44Tallinn University

    M i IBA ( d

  • 8/3/2019 Session3 Developing an Ios Prototype

    45/78

    ManagingIBAc(onsand

    Methods RepeatthestepsofaddinganewIBAc6onandcodeforthepageInfomethodtothe

    SecondViewController.

    January, 2012 45Tallinn University

    M i IBA ( d

  • 8/3/2019 Session3 Developing an Ios Prototype

    46/78

    ManagingIBAc(onsand

    Methods OpenyourstoryboardandselecttheInfobuoninthefirstview.

    MakesuretheConnec6onsinspectorisopened. Clickanddragtheconnec(onfromthepageInfoitemintheReceivedAc6onssec(ontotheInfo

    buononthefirstview.

    SelectTouchUpInsidefromthemenu.

    January, 2012 46Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    47/78

    January, 2012 47Tallinn University

    M i IBA ( d

  • 8/3/2019 Session3 Developing an Ios Prototype

    48/78

    ManagingIBAc(onsand

    Methods RepeatthestepsfortheInfobuoninthesecondview.

    January, 2012 48Tallinn University

    T ( Y Si l Vi

  • 8/3/2019 Session3 Developing an Ios Prototype

    49/78

    Tes(ngYourSingleView

    Applica(on

    January, 2012 49Tallinn University

    T ( Y Si l Vi

  • 8/3/2019 Session3 Developing an Ios Prototype

    50/78

    Tes(ngYourSingleView

    Applica(on OnceyouhavefinishedseHnguptheapplica(onpresstheRunbuoninthetop

    lecorneroftheXcodewindow.

    TheiOSSimulatorwilllaunchandyouwillbeabletotestyourapplica(on.

    January, 2012 50Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    51/78

    Crea(ngaTabbedApplica(on

    January, 2012 51Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    52/78

    Crea(ngaTabbedApplica(on

    GobacktoXcodeandpresstheStopbuoninthetoolbar.

    Openyourstoryboardandremovethetransi(onsbetweenviewsbyselec(ngthem

    andpressingtheBackspacebuononthe

    keyboard.

    January, 2012 52Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    53/78

    January, 2012 53Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    54/78

    Crea(ngaTabbedApplica(on

    AddaTabBarControllerfromtheObjectlibrary.

    Posi(ontheTabBarControllerjustbelowyourexis(ngviewsonthestoryboard.

    January, 2012 54Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    55/78

    January, 2012 55Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    56/78

    Crea(ngaTabbedApplica(on

    RemovetheviewswhichcamewiththeTabBarController.

    Posi(onyourexis(ngviewsbesidetheTabBarControlleronthecanvas.

    January, 2012 56Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    57/78

    January, 2012 57Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    58/78

    Crea(ngaTabbedApplica(on

    SelecttheTabBarControllerandintheAributesinspectorselectIsIni6alViewController.

    Control+click+dragtodragaconnec(onfromtheTabBarControllertothefirstview.

    ChooseRela6onship-viewControllersfromtheStoryboardSeguesmenu.

    Dothesameforthesecondview.

    January, 2012 58Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    59/78

    January, 2012 59Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    60/78

    Crea(ngaTabbedApplica(on

    ClickontheTabofthefirstviewandchangeits(tletoOneintheAributesinspector.

    Changethe(tleoftheTabonthesecondviewtoTwo.

    January, 2012 60Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    61/78

    January, 2012 61Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    62/78

    Crea(ngaTabbedApplica(on

    RemovetheSwitchViewsbuonfromeachoftheviews.

    Re-alignthelabelandtheInfobuononeachoftheviews.

    January, 2012 62Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    63/78

    January, 2012 63Tallinn University

    Managing Groups in the

  • 8/3/2019 Session3 Developing an Ios Prototype

    64/78

    ManagingGroupsinthe

    Projectierarchy

    January, 2012 64Tallinn University

    Managing Groups in the

  • 8/3/2019 Session3 Developing an Ios Prototype

    65/78

    ManagingGroupsinthe

    Projectierarchy RightclickontherootfolderintheProject

    navigator.

    SelectNewGroupfromthecontextmenu. RenamethenewgrouptoResources.

    January, 2012 65Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    66/78

    January, 2012 66Tallinn University

    Managing Groups in the

  • 8/3/2019 Session3 Developing an Ios Prototype

    67/78

    ManagingGroupsinthe

    Projectierarchy RightclickontheResourcesgroupandselectAddFilestoMyFirstApp.

    January, 2012 67Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    68/78

    January, 2012 68Tallinn University

    Managing Groups in the

  • 8/3/2019 Session3 Developing an Ios Prototype

    69/78

    ManagingGroupsinthe

    Projectierarchy NavigatetotheDesignTemplatesfolderandselecticons

    fromtheGlyphishiconset.

    IfyoudonothavetheGlyphishiconsonyourcomputeryoucandownloadthemfrom

    hp://glyphish.com/download/glyphish-icons.zip

    Choosetwoiconsofyourliking. MakesurethattheCopyitemsintodes6na6ongroups

    folder(ifneeded)op(onisselected. ClicktheAddbuon.

    January, 2012 69Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    70/78

    January, 2012 70Tallinn University

    Managing Groups in the

  • 8/3/2019 Session3 Developing an Ios Prototype

    71/78

    ManagingGroupsinthe

    Projectierarchy TheiconsyouhaveaddedshouldappearintheResourcesgroupintheProject

    navigator.

    January, 2012 71Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    72/78

    January, 2012 72Tallinn University

    Customizing a Tabbed

  • 8/3/2019 Session3 Developing an Ios Prototype

    73/78

    CustomizingaTabbed

    Applica(on

    January, 2012 73Tallinn University

    Customizing a Tabbed

  • 8/3/2019 Session3 Developing an Ios Prototype

    74/78

    CustomizingaTabbed

    Applica(on Openyourstoryboard. Selectthetabofthefirstview. IntheAributesinspectorselectaniconfromtheImagedropdownmenu.

    Dothesameforthetabofthesecondview.

    January, 2012 74Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    75/78

    January, 2012 75Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    76/78

    Tes(ngYourTabbedApplica(on

    OnceyouhavefinishedcustomizingyouruserinterfaceclicktheRunbuoninthe

    toolbar.

    TheiOSSimulatorwilllaunchandyouwillbeabletotestyourtabbedapplica(on.

    January, 2012 76Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    77/78

    January, 2012 77Tallinn University

  • 8/3/2019 Session3 Developing an Ios Prototype

    78/78

    DevelopinganiOSPrototype

    Andsowecovered... Crea(ngasingleviewapplica(on

    GeHngfamiliarwithXcode DesigningviewsinXcode ManagingUIViewControllersubclasses ManagingIBAc(onsandmethods Tes(ngyoursingleviewapplica(on

    Crea(ngatabbedapplica(on Managinggroupsintheprojecthierarchy Customizingatabbedapplica(on Tes(ngyourtabbedapplica(on