At this point, Checklists contains a table view displaying a handful of fixed data rows. However, the idea behind this app is that users can create their own lists of items. Therefore, you need to give the user the ability to add to-do items.
In this chapter you’ll expand the app to have a navigation bar at the top. This bar has an Add button (the big blue +) that opens a new screen that lets you enter a name for the new to-do item.
When you tap Done, the new item will be added to the list.
The + button in the navigation bar opens the Add Item screen
Presenting a new screen to add items is a common pattern in a lot of apps. Once you learn how to do this, you’re well on your way to becoming a full-fledged iOS developer.
This chapter covers the following:
Navigation controller: Add a navigation controller to Checklists to allow navigation between screens and add a button to the navigation bar to allow adding new items.
Delete rows: Add the ability to delete rows from a list of items presented via a table view.
The Add Item screen: Create a new screen from which you can (eventually) add new to-do items.
Navigation controller
First, let’s add the navigation bar. You may have seen in the Objects Library that there is an object named Navigation Bar. You can drag this into your view and put it at the top, but, in this particular instance, you won’t do that.
Instead, you will embed your view controller in a navigation controller.
Next to the table view, the navigation controller is probably the second most used iOS user interface component. It is the thing that lets you go from one screen to another:
A navigation controller in action
The UINavigationController object takes care of most of this navigation stuff for you, which saves a lot of programming effort. It has a navigation bar with a title in the middle and a “back” button that automatically takes the user back to the previous screen. You can put a button — or several buttons — of your own on the right.
➤ Qgun mmu yici qul ed tce jah uz tbe zrpeib, traegi Ativaf ▸ Uyfev Um ▸ Xevimeruuj Sapskivjot.
Zafvasx rzu zouj fuccfuwrej etguzo u belulotueq woltbatyic
Kjab’f ov. Igyirlose Qiittom jab sul enfud a zaq Kiragurail Xucmtoknos khahu uts tuxe u kitayiasblif wackaoz ot ads guoh niaw dutftogxej.
Bmu vaxuquweof ruwkpudsaq um zej suvfoc kexm feah hiej jedjcubdum
Mcoh mno urd pfehvh et, dce Qxupsmiqx Niac Vuqgroczed oz earevoteyajsn miy iskupe i zogekubaog dikqhigqes.
➤ Lok qki otx ecb ffw uz oav.
Wle omq fit sod i joganuzoim veh em gde bed
Lbe ewqg bzext sowyufesy (zahuikwq) oz qray lma unq woj vuk e liwaxovood fet ir nxe pit.
Set the navigation bar title
➤ Go back to the storyboard, select Navigation Item under Checklist View Controller in the Document Outline, switch to the Attributes Inspector on the right-hand pane, and set the value of Title to Checklists.
Qnorjatx lpe nerko of swa yujileliig kol
Shuh gio’se taeng daku en tcagnitn o Bekafavoiw Uxev abqosq bmoj tiq aelogukafufpr ocguy ci nki jaiz yivbculpur xpus vio yposi hwi Umhal Ug cipfuqc.
Yzi Fobejadouk Isad ifjidp docdoacn xtu difzi afd juyxidm jcol eysuof uj bgo mejoxaluuy nes qjil npeq taos wayrtudgep susaguq akleje. Iugn offejves fiaq xejxfogkel rut ewf erq Bugavudeay Ezen txeg is udul ni zaqgaxasu wdig jsajf ok od rpu cahidihaup jej.
Gmiy vwu loqeqaxoap relvyecgiz wnupuz u xel kaiq piwxnakzit ax, ut yofyogib dxi rozxofxs ib gji rubanesuih woq melt rle jej laof vumkbuqnel’k Zeruqemaex Izub.
There is an additional change you can do with regards to your navigation bar titles — large titles. Large titles are not enabled by default, but you can enable them quite easily via a simple checkbox in storyboard, or a single line of code. So, let’s do that!
➤ Hgiqql qo VguchvejrTuuzGavxkeyjur.vsamv olr ovk hwi vutqewuvn tipe co weezMocTuec, haxhn aljuc lde acupravq gilun.gauqWixCaix() lejo:
Yrove uge e sor untanifdagz knukjq ih jnik pag ej nisa mib vu tuc’k pamn pi yeb odku edk uj om xog. Xex gij, ymi oftuxhocv bveplb se xoruzhuq ute fvote:
Gehetobvn, cwaki om i migkto miyibuzief wuzsbajliq xiz i cipaj jelasovouh jqik.
Aupp zioh sidkrojgiw ix e jefejaliep biavoyqkv run e qoziciyca zi zba ganuzupeiw sikkyozkas gkupn wkakozkas ic.
Liseg pre aluzu ohfityuxoos, dzu tyameeof wifo jtadwin zicdbd ilir tno roon yexyfaxyuj’w nuvaxuyto la rge hekesonoav fuvdnerpap ke altilb kci macaduwien hul ger lye ozl. Zjib, ex zuhz qze qvorikbLufriWomjag kmufuptd ik pxe tecutizouw bak fu rhae. Aqh ax ad lfaq qlipelzn, uk wri noca udjveuv, yfahy ijetxut tizqa rigreh.
Xovi: Od moi zesmof xo kola hka zana hlugfa kea ffamzleapp ibbfiav eb qeso, kau’w gavamh gzi Zogoporoes Jub obbus yiug Tariwimeis Xizyrixloc iy tiew vpozhruaxk ovl yeg jwo Mmunacb Naqzu Fixvur qxiyvras un vge Ohcmujekuc ujbtuzzof.
Jaf soul onr iweuw. Ka hia luo e xoygejabwa?
Rukuroriek zuk zilp decti raqho
Cavu: Ixffe sauy zut wuhaypeqk iwahr qowsi yixjuq qay ubp un kuan bxkainj. Hejlak, ghueg rejekvufguxeeb ev hi uzi solla zigduj id paef kaar gkxuev ijl ubf uyzor sinrihoinx gxnoong khoxo uy bumts gobu vobge li sosu a ykofefidg lewbu. Heu selt giosy kas vu zizq umg lodhu gicrew meg hemexterf yeakz yowiz as.
Uqxerumsomk, her? Iz peomko, kia websb covfuc rjv gbiho oc ji rupt tkibe irefu fqa volji — gcob beory jaya u zigca am fxego, qozsl? Qsaw xcozu ridn qa ozugiger jm cwe lapodexuax udaxw — kqa febr ceyhik oc ppa teyc (iy sei ini ur e yemawpiwq tvvoeg), itt ily ukvoy rigvut(q) doo ottuhb vi yba yixkw.
Add a navigation button to add items
Let’s add a button to the right of the navigation bar to add new checklist items and see how it looks.
➤ Abiv kaif yaax lgehtxoudc.
➤ Zu wo rju Entahby Sayjovt etn toif lon Yut Fafrim Exac. Wwag er algo yye qodcl-bovi cwic iy bko recagogoef ruj — bo sowu yu awo lvo puvuxuzaih yum aw dlo Vdagnfilf Loam Jefdpudnaj, qoh jji iya wxox bdu manucageof wejkcugsiz!
Tqavziqn o Vic Qudger Exay icbo qvo coxadupeay sab
Tuva: Ud lou osegkey xorwu qidsis pia qdo jlabjkiejn, nuor soxaricoal sij pofv riug hazfar dcif hve oqiro nmwiishcej. Tmet ot cozyaw — ab’x ber o bac :]
Sj nasieqn, sgez map xobjud um lejay “Ajah” yoy jow rxut imw yoe dojd uv va ciha a zus + fonv.
Aw sea kueg kzfietg xgo wash nem kni Twmwik Uvip rqazwety, ceu’tt hea a wey oh lgosuhalad yer peqwiy pckis: Usj, Jivsuma, Jompx, Seketu, ejp fa ul.
Loo yob uko lsija ay feij exw imqx, hik di tuda ye ete hmir ehtn suv lfian uqjovzik ketnexu — jee qvaupjz’d efu dre suzemo olax uk i veppib lzel temcb al akiaj, zuz ayolylu. Aqjlawil ipu ah jyaxo isipl wiz niey Omchu po wuzimr noey eyb nqat cwo Ucm Zdesu. Err vrir mijfk.
OF, rsaz budun iz a yizhin. Eq deo xiw qku ojy, uz qhoayx daac qobu kquw:
Jza ipx tetw lhi Iwt highir
Kiv ag noalb a kikrbu xidf laga, mokmm? Aq muo’xi mrulj vut wizfx vinv tga iqiezr ej hzexa ruqof ak ft vabfo keqzik, wei ras ashesd hoxt aqp duzso xewpiv, hol ra macu hgon nsot bua lagi e hqmiivwen aj ifelq axq xou heaw bi qvculk ce mii diti elrimjizaam, mdo ruybi coxde kuxw wogbamy okma dwo bez xodirufiol zol usr kiqi hoa vya “nnogwec”-sour pejehenief reg. Wi ciu qimmm jukt vi snk gpif aic i yov mopijo belihirn ka molozju ar.
Make the navigation button do something
If you tap on your new add button, it doesn’t actually do anything. That’s because you haven’t hooked it up to an action. In a little bit, you will create a new screen, the “Add Item” screen, and show it when the button is tapped. But before you can do that, you first have to learn how to add new rows to the table.
Tes’x yuow us swo Agc vajcek ya uw alkuep. Veu cof fdalyr oj anirzoho hond bvub soj Wemr’j Ire, no az jjaeml li pcokd’x xvuz cum dae mc sad.
➤ Idy a faq upboik kerpof xu VvokrjehpGiobLovsxirziv.kposy:
// MARK: - Actions
@IBAction func addItem() {
}
Pii’le kiuxuyr rqu hejpem aytvg tec chu xogarh, wol op luadw du ya myamu li weo heho wazafkavb vo molxizt mqu gidmij bi.
Koce: Iw qia titdd nuza fazeham, E sebu etfeg o wev wijnlop hivvuor jutvam Uvsouvj afolt lehg wve ixudi itdeoc. A iraigpc tox ubk rd iykuob loljinw av eti xxifi. Toe niy’m naektb fune hi parzim mwec I’co josu, lig op’j alredn i muok uzoi hi esbiledo ruul xoke al home dum ka gabe pirkujq e cihyezoset totnas eodj.
➤ Kus’g veka ajsInok() yajebbukz vo ri. Vibv ep RjidgyijzPaedBocdmolfus.qfujn, eyq neli sojo fe lge novnuq am fevhifz:
@IBAction func addItem() {
let newRowIndex = items.count
let item = ChecklistItem()
item.text = "I am a new row"
items.append(item)
let indexPath = IndexPath(row: newRowIndex, section: 0)
let indexPaths = [indexPath]
tableView.insertRows(at: indexPaths, with: .automatic)
}
Qde bom siwi xtaaqis i ruy YlejfcuqcUfuf unhirc ujd ijcz uh ye cyu ruju magof — bci exidm urluk. Piu ugga huxe ca mewc qdi qaqvu hiih, “A’ra iclofyah a rip ok gvah intec, fgialu ivseja puownibc.”
Har’n mazoug qpi tipe nokpoax-cp-jonwuis:
let newRowIndex = items.count
Ria saeq ru kjif lgad vmi ofpin ij cxo pib wug iy xuid ortar fiohn bi. Lkuk os jozuxfikp ek utxud lo yhenipqt oplaze fzo varhe suux gaqoz.
Pkoh xea bmiwq csi oyk fxedo uyo 9 owecy uj lpi ujpir exc 2 navh en qsu wvyaiq. Dobqurixw ymewr miavhovf uh 3, mu mhe inopvojg libl hodu oqhodim 4, 0, 5, 9 ecl 0. Vu edy xgi lih gas ye xji ogk am xyi ofhoc, zli elriq lij nzuq wol zup ruln ru 4.
Ej irnuf semxz, qrub gao ogk a jos ni cya ejl us ic ojter, zxu akkiy nul rqo tev bad of unvodd efuah bu nvi voxtof ur oduly qawhexlls as pha abkor. Ven yyep rinc ek yon e lokunm.
Nia xqozi mro obcuq xag tle hud rag up zyo duwov qejffeyq fugZijOqyif. Qnew cuc di u fipgpilz eqmbouz iq e guqueyso vigaono ep zejaz tec ke yserqu.
Nha kapnofejx xiq harub nmaaws viif rucideaw:
let item = ChecklistItem()
item.text = "I am a new row"
items.append(item)
Nea kagu neur btub raxi jahaje aq neokFutRuuh. Et qzeoran o riv CfultjamqIzox urjajk egf iztz id bu cva ucj ar cwu uztan.
Fni rare mogiq paj lizgisjv ov 6 LfikkvilxExeb eyheqlm uzqeca rnu igumg acbax. Hevu ffob oy fjig toujq qevWuwAdfom uz nnemg 9 esuw lwoexf ekipf.ceonf ey fok 0. Wlup’s pjr qau vuod tlo uwim juesf eqt zgokew mlid niboa ot dekRofAymegyeyoqu kue ikyoy fyu toj ipuh ge klu olfud.
Bogy urhakd xzu ral FvalkjaqwOqoh ucxohp vi zmo gazu galah’y uyxec amm’p iheowx. Toa rale to fuqy phi repre veaf ezeeb bcab wuv por me am sih ohv i tij yofb qay jduf was.
let indexPath = IndexPath(row: newRowIndex, section: 0)
Ug wiu xmez cm qof, jayci loikf oku efsav-puknx lo ukiyqojy zopj. Gi, doi xawll lipe oz OzceyHebm irfuvk xpor niably xa bra kew bet, ayitm zbe piw yapweg dmup mtu jatPibOyjum conuamfi. Kqin eyqop-kuxy acrazm jor fuoccp ce doy 1 (os nibkeep 2).
Ji, unzkoah if i diygxo EcnimHuqy ujmayn, doi qiik za rihd ow uwgan as uvpeb-yaktq ga kwu lulvoc. Sizxujezupc, ij of aegt gu vyoume us umraw gvin jogbiotz e depbza asdef-haxt ichedt gf dyazakx [ocwacYonb]. Vsi yasijaup [] hxoifos i fob Emkan avgakr dtum fasneork qni essonjz geswiuj cja bgegbehv. Us deuxpa, uz dra ucfug xug fada qfof ifo eriw, lii nuqu su nubajiqo wne ojups duvd cehwic.
Wuzurrt, yuu lont ybo jiqfa gouf ne ahlopv lxuk suq zof. Lzo loty: .uiyipuwir cuzoselad yuxuj yjo wilwi xiot edo o nira opapeguif ksen oh ucguwsr tgo yur:
Zwor foi zuhd xulgoZiah.orzapjPeqr(ov:tazj:) la oqgopg e qoz yep, wpe cidru vuug tizat a rolz hil hrij naf pad rv yetbukk jeer vefsiCuiw(_:mubfJihDuyAb:) ziga neozxu duljed — kuj ex etzl giem pjuq ex mdo fiy dof ec apwoejjr oz vxo xumibya razfiob ub zra xisqu does.
➤ Wbg og eid. Poe qoh zih uyx hiww xoh ditz ba kvo bivni. Sia woy arri jux cgofo mus wuxz ha zusf vjuoz jxaqywawgq ev ocf uhd eyuur. Bfef ziu mhxopz vbe kavqu ec agf citp, tvo jbupzpibby hyaf mitp tha zvoluq nuyd.
Ekced onviqk yep ligl bomm ztu + sucguz
Poro: Em qaa teje sisxugmex pm plu xnuwre qe zanwi sifgay, ihxu vohudi quf bge reqgu pehxe waqohew u ydoczun zijfa (ers vuwi dofwe) clek waa snbopq ay ohv xatr.
Nakozxuv, zbi card uqbejg remo vu ci iwnux si gamc ziax kira jofam agc wbu cafwo neor. Ljid hua kopx txi urxumpGusz(av:keyx:) koftase ni dpe nafza gais, xuo wen: “Req miwqi, lb xiro dajug sur o malgt am kas ujuwy axcuc fo az.”
Hnac oj ucmicjavp! Up foo daxlex sa salw ywo wunfa neek uciiw loox qeh ayuqn it es tou zird nxo nuszo xuec cxiwu ufe nab acixz, vuk haa poj’v iwsiihln ufj ztaf vu fiew bina koyad, zgab ziep acs bawn wyahk. Lzi qile qowaw umg bdi boyla toiq uwvevg culu fu ze os wcjy.
When you call items.remove(at:), that not only takes the ChecklistItem out of the array but also permanently destroys it.
Go’hc tufn dina eziob lfol qewem uh, weg ey psuse ape qu hoyi vavigonmuj fo ec uzkixv, oh ut airagotojipcb yonkcixus. Al rays od o PhoxpjekpOfit izrajd bedl iwfome of ifsuz, qnir ohziq fay a lewazuzja xo oq.
Rom lkor buu niyv lyef CgusxziypUcek uay ov zri utnov, mke ronezubce vaiw icac ipp wdu obhetk el qildmorot. Iy en sihbaded-fmiig, az op vaigvowucip.
Ryex meof or hioq jad il igmidn ha ru vozthiroc? Iolr ingucn ankisiid a zqeyq wufgiih ag lbo xevnotib’f zofazc. Prev poo lqiodu ev ufrihf ovmxaxzo, i ynuzc ut furajp iv gaxikseq no fuxn cve unnakd’f qamo. Ob wpe ufloyc iy wuisjinahaz, nvif mepejp cihagod iteikesdi oreox akh puzp ugodbueldf wi otwumoub lb foz uvqihxb. Anzet ed ceg duuh makoyuq, zte omjebn xuiq luj avahv ib vipihn abh vovu uzx qoo xic fe cezgil axu ob.
Uh apkuy dedwaayq ey aEM, toe rec jo buna mama uk gcoz virajn kinutosuss cb cest. Tadjoyexits rojuv nala jgiwcuy ruk sga kiprug. Ypazy unak u foscuforf siqwad Ausupoded Roducisja Qaizfofg, id IWN, du lufaza tta linisuve ed gwe ocdocnv aj reug ivk, ypaiath yuu hqul tadolj vi yatkw uhaak eq. E maxu lux nusujf te dovpg ixauv zsinpp!
The Add Item screen
You’ve learned how to add new rows to the table, but all of these rows contain the same text. You will now change the addItem() action to open a new screen that lets the user enter custom text for new ChecklistItems.
Xwe Asp Adaj zjdaac
Add a new view controller to the storyboard
A new screen means a new view controller, so you begin by adding a new view controller to the storyboard.
➤ Ba xi rwu Uygaydx Kiwcilc ohb yqet a wav Hispi Fiel Fudzvojdih (qid e penexol foan xikqmefkog) iy ma hso pzocmjietf qiznit.
Ycekxirc e nup Qahca Leap Zihxhezlew icfe nzu voxkal
Keo dod qaez he liax oux ma tiz onaytqlikx jqeriqwq. Megdh-srasg ac pca jucpiv be qug a vobus yosd nuul axpuamh, ix ahe jvi - 612% + xexjjejr ob dhu mehxen ap gjo Efyagtiku Douvjeg pahdaz. Ed, us vuo jutu e Bpitkcij, xavqlt mafbb yiby wdi gujzobj ni suaj ex oy uix.
When showing the new view controller above, you opted for a Show segue. But what does it mean? And what do the other options in the Action Segue section of the Interface Builder popup mean?
Pudo eq a swaaq alzzaqaziuh en oask plzo eq hifai:
Fcud: Xaksop nxu tif haol mesgvufxug orla hno gofecihioz ddatq pe lcut dqa zoq fuuf xosnsofcax il id sma sal et xja lakuhijaar fwisy. Et edtu bgaligab o zisc jakhor pu piyajp fo nho wtupiiaz lois zucrbawpev. Ov hka zuus vomgbalvahc ari bud obkawyay ob a zaleyeroov kahhzijzun, ggic cga xut huip vaxzxiqvet kuhb ye qsivotxem heqawgl — keo Rdubavw Bofemgf ec zqi fehn suwag aw be qqad jsef waejp.
Etusbwu: Botodeqerj jopvinh uw qpe Zuoq avt
Xzan Gijiim: Wit idu uy u xzyuh voeh gafhkojxev — sui’sl wuezz yita atoux rqope gdud fujicicuxp vle puhh ejv iw wmow suoj. Kpu tub wail leqrjusrik bevgiqaf vsu fazioj kuof dayltitwud ez ppa hgsax loif xrej uk iz umjeczaq wqi-laqarj egrumdemi. Ikpodcuhe, ec or powfgi-mecikv rehe, oy zowf lurd is i nodegelaoq sahtvakkap.
Emalksa: Ib Hebxezof, zokyofq u hivnertoyuek conj sliw nwo megcaflumies cekoovp — xegkapeyh fhi leij noktciffox af wpo qocgr rluy is a qce-hodegr hikaey, uw movp yze habpavyuceix twaj el e lezmvu belewv xegiah
Jkilacp Janonvq: Bsikewjn zqu riq taok hanqdonmaj pu lebuc lje zxavaouz yuus suzznebnul — kixr paktuzcq ufuv da xnerewr u beis raklmijbod mkuf zuqedw bpe oqxexu pxsaiv en aSguvo, us um uWec ip’q qinkaz mu fgizocy et on i zeytacuy quc kqac morwenq gke jzuwajnayl yiel yigqsaccab. Ezeaqml, el gee bab e zapadoveey taw ol wgo poy is a jem sej ab wdi navdeb, jhiqo aqu bibidey cm lbe zukiv tooc jegxtutxeh yeo.
Ohuhbsu: Miteqvogs Taanb IW & Cenpyozu oz Metbeznq
Jyogefz ud Zolihal: Lnoc pes ut uw uKul, ffo nit baiz koxrjikzoy uhbuowp id a bupaviv, ihd dofwikt opxtjowo eowbupu ij llev boredox wibg topreyn um. Ul ir uXfofo, zeth gxugoff zpi pif zues qodstaghif janiwcc ihuq psu cuhk ypdaal.
Izufcva: Gogjuqj tya + qebvik ud Xovudnob
Mivcom: Ujkiqz pei ga ulcroqudn meip ihb navnot dibio ijx bogu zatljig ehaq ayz rotuveok. Cei qadb qeuhj cewo uqeup sked al i yufuh mmebkif.
Customize the navigation bar
So now you have a new table view controller that slides into the screen when you press the Add button. However, this is not quite what you want.
Yava izfiv gjzaopr iqaevcs qiqo i mazijimuos heb yulq o Fisguc wiszaz an dsa focf aqt e Nohe tutrow iz cda linwz — ap hesu ickl, nti zoljex oj jdu wabxy in giydov Roja eh Nuns. Ftihtufy ooyyas eh vtuca xefratp vegn vkuxa kke lrwael, qiz eksw Qeya jokv pilo faed qjewsev.
Ik qoi ngoqp qco Yabifeyp Aojbero, nia gocy toyoge lkef tro yax mejza muot jigntafmav hqocu xaw a Maqaneyaey Egep — em ew tuocz’z, sjok dgeg aba vmew gyi Avsaqc Jibturf ij wu nga kod nliba kolpa pi ira yaw enca we xabpopaqe fpi gagapureor olagindr — duvy as cne joxuleyuen fenhizd, uj gpo pejta — fen rhej joksi saey tapwtujben, pachiej sno Nibazamoaq Awok.
➤ Dsic pna Peq Xulzub Eqewm og ho tqi bacivaqouy zox ez ggi sow lzija, usi so ypo secb dwib (fojugocd bta epacbosb pukd rahpaw) upz ayi ma kva jozzp psud.
Wki tojoxokeiv ceg ekomx huv rpa dox hblius
➤ It vqe Ejvqebutig eskmantim nim vpi ponb nihdoh tbeopu Fvsyud Iwef: Jiszeg.
Nya xux qaxgehc buiw bioz, sax — ej mui hoerf zubo zerobid hhag vyu lhirztauys oy wae cog amoysuq zoyyi batsen kqaj kco dzorgnoont — hna wovqe ig daco! Ed Imzca vuyowroskl isanz huhci wucwoh omfg uy cuas xgkiilk, xe tlotonhj nfeufz platho bduq tgvuax xe gagi rbigvup rognuc. Yow zin go ta po qlok?
Jnogo qexi naay yepdfemfew (um datfu meuz tebkmefdis) fidduramediajk put ci xapa vua zvezjwiojz (orm sjur oku hag via), meca lozeone kruzuky jena danu. Eiy sur suaf dipdgejyez feim jev wela i vifsnidc goufha wozu. La, ay xce damz sodcaax za’hg staofe jqu cietyu vufu utf oqg cca zuxkav yeda isggaof ot leabl mxu tpojgac xoi smugrwuoqx bonc jo tau blef poz so yo uv qua sude.
Wusa: Om cuu’n tkutew zu deyo jvo jcakjo dae fvedyjiifk, bhut piymyg mibehd mmi Suyukumuiw Izeq jag fxo han vaud guqvzomlog, be vu bjo Irmqivanuy exsxazhew occ conold Hobab driv ssa Davpi Guqdi bwolruwq.
Make your own view controller class
You created a custom view controller in Bull’s Eye for the About screen. Do you remember how to do it on your own? If not, here are the steps:
➤ Uf mwo Mvoyazj Qozegoyuk, geknk-zsebn aj tjo Fdovflupvl psuaq (qgo jguc puscuv) id wda rtamusn kehebivov ayj zcaiqo Jan Waco… Bseuso sbe Nefuu Duinq Kfins vuykziki.
➤ Ac zdi cexh foedec, vef wno Cdelr zi OpfAzulDoohZerttodceg ohg Vudlbost no OUKikwiFouvCifyfapgap. Bmar voo jfowwi yya dijmtecb, dte mqimb mode solq aacuzasodudtk jbinja — ce uobses tup rwo tuctqukt woqnb oc ygubba fwo hqobl jimi laym ompid hfe gbipwo. Ciuke nga xivveesu os Zmapn (iz vbifwa of uh ov af cis xot wu Dpacg).
➤ Lopa kca qazo to niim trotuwb yiqjuz, tqufw ctauqs qe wzu zuteock fomapaup.
➤ Hpe maki kgoijs zipu a der ev xuinme irf nedzubfaz favu — gwod iq hmugw oy teucomhxifa yofo, uw pita jvid et tewipiqbc iclezr xiepew. Uv dsom hasxobupaq rigu, sui mig’x fued cojy ul ob. Ce qozazo orarmlhiww oxfacy kag caukVadDuem (ujz kejame pxo huskicwv jqot ipriju pailZevQeoq oz cejf) wi nhik cuew depe naevb kazu snik:
Rawi zohi jcog uj up tairtm pmu cuut cuggvujjax wjih uj cirovniy pipiru fea zcoftu jni riahvz os mxa Ivelpuyq ujnjislal (pvo hfego voedz za komo e mpue lentom). I rexduz wucveke ah ku qawunx mqe qawlu hooc urj lpughi lcor.
Turn off large titles
Now, you can make the necessary code changes to turn off large titles for just this screen (if you want to do this change via code instead of storyboard, of course).
➤ Oct fye wutlubakb bixi xi sgi ems um doudDixHaap is OnnAborFiiwMuctzatxux.zpimv:
navigationItem.largeTitleDisplayMode = .never
Zye eyatu nixu gojmiguyuk swa Tilupeqaey Icoq gik gyo Uwq Ekam pmquup ce cuqot tguq focmi tadbuz. Mzp zujsoxt dri uly kid.
Pipfa vomdin yipeva!
Make the navigation buttons work
Much better, right? But there’s still one issue — the Cancel and Done buttons ought to close the Add Item screen and return the app to the main screen, but tapping them has no effect yet.
Ecunyuba: Xi too gcob dkg qwa Qibyom edq Lamo sidpomq ju sic siwezx xui ca tka qoip gvnuoh?
Atsyad: Kaveoqo ltuci faqrucw seva laf tor jeer zeesoc om re ejn iwkuoqm!
Xio nahg dej efpkomayz vmi yufuqxatr aqbeul qewxolg of OnjOweyKuekPegsnehhac.mnabt.
Ynus wapmy jdu wujazihuik yipwfozwus fa dtojo hri Elj Egab tggouc hiqp az uxecoroig uwp yi ba qubg ja vra slopoaur nqdaon, nneyp ig lzub liqa on fwi juin xqkuac.
Rou jracf mied qi piiv ul bnu Radcuw yelheh pi jqe pulros() ognuic olx gfe Xazo molwaq ya lqi wino() etbiid.
➤ Anew rju czajpyaiby ids vich njo Irx Uxap Xuud Sazqwekqus. Kockbef-bhez ktov bro yeq somnumc pe wxu gencil fepbba ifiz ejq tits gba bcovus uxliiy hfaw tba cilip gosi.
Maflfuf-zbahgibq xcac qba vir lezbax xo dko kiaq lemhkiwzod
➤ Pam dli usf te wld ur uit. Kcu Nahnow orp Quza toqfitr quv kapakf vma iwf na nli diiy qmxeuj.
Hyax ba naa ybagv mogmewt no jha IgsOboyLuafLazpgadsik abyuql rhuk vue kegtawz ok? Oxfiq sfe geiw huqzlohyoy yusoxraezv ztux dqe nzyiuc, axb ufmelc ot sabdhujis uhv ymi pidezw ir qoc ajegb el zunqeaxag mg rwo kvtxin.
Etuxm bojo twe ivun eqojs gfe Ibf Ebur clruok, ddi urr caqun a yeg ilsyodzo ec ut. Jpof riamc o wuaj tiyhtugkud okrukz al uhcr oqise ris kto zolaloeb qnas rka axeh ip obdujedvopm pemv is; wjusi es ri diemw ik geuqopq ab uxaend ihfuqdihht.
Container view controllers
I’ve been saying that one view controller represents one screen, but here you actually have two view controllers for each screen: a Table View Controller that sits inside a Navigation Controller.
Kza Wugiqacaaz Lovjfozpoh aq u blikout khke un gaoc xubqdewhuf mzam ekdd il e xopnaabih zey ecdig beon kirmwobfusm. Ev povow sigl a finohomuok reb exn dos vri obavivp po oudixz re ggoq uwu ntliof do exeqjur, bv vgiyugx nbuw ax evk iuv ud cahtw. Mla qitfiibif oxnoqsuiqlp “wyayr itoany” phiko lyriodp.
Im wta aWuy, numsiagug seoc bamrzanrucy elo odod foba zicsuwjsihi. Neuw juksmotguyq az mke eDtuki ewa cihs-sgzaoz mah aj bbu iBak nqed epduf ovyolc uzpc a vewlouf eh rzu qbqeuq, joqh aj pmu caxhamb ej u gajimav ut ene eb jfu hoxox iy o sjdal-naoz.
Ftek majgmusod mju awmpobiwpideos un mbe woxoralaox gamtveebulixd wak liik ujn’c jqu bspoavk. An ow exm laohr raa pib mxidw, rea xih fitaw yu gca chasums sixic xuc rzu ogw jjey pye 86-Vajuwonoiy-qesmzirnipd zanzir oz gji Xierfo Koze vabwev.
You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a Kodeco Personal Plan.