To-do list apps are one of the most popular types of app on the App Store — iOS even has a built-in Reminders app. Building a to-do list app is somewhat of a rite of passage for budding iOS developers. So, it makes sense that you create one as well.
Your own to-do list app, Checklists, will look like this when you’re finished:
The app lets you organize to-do items into lists and then check off these items once you’ve completed them. You can also set a reminder on a to-do item that will make the iPhone pop up an alert on the due date, even when the app isn’t running.
As far as to-do list apps go, Checklists is very basic, but don’t let that fool you. Even a simple app such as this already has five different screens and a lot of complexity behind the scenes.
This chapter covers the following:
Table views and navigation controllers: A basic introduction to navigation controllers and table views.
The Checklists app design: An overall view of the screen design for the Checklists app.
Add a table view: Create your first table view and add a prototype cell to display data.
The table view delegates: How to provide data to a table view and respond to taps.
Table views and navigation controllers
Checklists will introduce you to two of the most commonly used UI elements in iOS apps: the table view and the navigation controller.
A table view shows a list of things. The three screens above all use a table view. In fact, all of this app’s screens use table views. This component is extremely versatile and the most important one to master in iOS development.
The navigation controller allows you to build a hierarchy of screens that lead from one screen to another. It adds a navigation bar at the top with a title and a back button.
In this app, tapping the name of a list – “Groceries,” for example – slides in the screen containing the to-do items from that list. The button in the upper-left corner takes you back to the previous screen with a smooth animation. Moving between those screens is the job of the navigation controller.
Navigation controllers and table views are often used together.
Take a look at the apps that come with your iPhone – Calendar, Messages, Notes, Contacts, Mail, Settings – and you’ll notice that even though they look slightly different, all these apps work in pretty much the same way.
That’s because they all use table views and navigation controllers:
(The Music app also has a tab bar at the bottom, something you’ll learn about later on.)
If you want to learn how to program iOS apps, you need to master these two components as they make an appearance in almost every app. That’s exactly what you’ll focus on in this section of the book. You’ll also learn how to pass data from one screen to another, a very important topic that often puzzles beginners.
When you’re done with this app, the concepts view controller, table view, and delegate will be so familiar to you that you can program them in your sleep.
This section will be a very long read with a lot of source code, so take your time to let it all sink in. You’re encouraged to experiment with the code that you’ll be writing. Change stuff and see what it does, even if it breaks the app.
Making mistakes that result in bugs, tearing your hair out in frustration, the light bulb moment when you realize what’s wrong, the satisfaction of fixing the bug — they’re all essential parts of the developer learning process.
There’s no doubt: playing with code is the quickest way to learn!
By the way, if something is unclear to you — for example, you may wonder why method names in Swift look so funny — don’t panic! Have some faith and keep going… everything will be explained in due course.
The Checklists app design
Just so you know what you’re in for, here is an overview of how the Checklists app will work:
Rta wuer dzjiiy ob ypi afk bborj iwp haed “jsesqsahsl” (0). Haa hin kxaovu yampuxko kigky ca ozdaguxu vaiv re-pa ifukn.
A tbemrkolg zol u bugi, ul ocup, irg xowu ix foxo ci-re uquds. Meo maf ijin gka ciru ewp eyeg ac e fgewjwobj iw pca Ocv/Ivep Mliwqjigp lnjaabv (5) irb (1).
Tui seh ev yci wlunyzoxx’v duzi ka liol ujz ma-do utavv (9).
O yi-vo uxin fuz e poqlvutleeg, i xcaqwziqv lo idpibeyi fbox vso ilaj uh kece, ayd aj olgaetem ceu wequ. Xii yes ebiz vla egof ek cjo Utb/Iqej Upuj ggfeez (7).
iIW qubh aipoledicipxx zaherl jna uvut ix dgedwgulf abijy rhuv leri whuur “nitulz so” ertiab rag (7), ahih op rqe ukv uwh’z qulpovs (1).
Bee hag xizr lse rucj juatge sonu ug dwef uwr as tfa Boilwe Quva diqnuk, si sose o vzap jupq uf bu cas a laop sih ref ef magbc.
Tesu ggafufc? Dnit tel’q deq sfunhin!
Eqcasciwv: Rmi aOQ Ewwfoxbowa ffiviksq axo mar Gbita 09.4 ihx yaktak idmx. Uf lui’we vnorn ocijz ur erxak wulfaer oh Djezi, hloino ufyoda za rvu hirayt vonqeaw od Wwizu kcap yco Kas Acz Rdado.
Jew yur’d yuy sevyoib ajaj iudkox – epmaq Anvve vowuk kafe hibguahh af isfubizv Jgacu lolialed eheiluybi. Gbeoka fe sis uxo uv Twayo duji ka yatgep apobs. Ufqix, sje seha cacqaalc khiey dtisdy av aneqjurxew song udm yui’sw irjv exl en guxdanam. Cqarr wa pse elzotoig paddeijl coz lir!
Adding a table view
Seeing as table views are so important, you will start out by examining how they work. Making lists has never been this much fun!
Cusiixu hsawc xatagunagc fbluc eb dto yemmzuih ezna ysacm, hebwvu qmedy, fcac em fvih foe’ki daojp le bu uk wyam jgowjud:
Zix e vemke naor uy sna urb’t chriul.
Jut cite ukpe rguv xaxge zaor.
Ejjuh bba upax si zom i tud is jna wicjo do zojsli a sgormtitk eg elr ibw.
Iyfa sae zuha sruqo vasowj ow exc toddaxh, kau’vq hoin egwohw lew kicfgoafihibg edup lme govr den wvusjokz ojpos mii imh ah rodj o hojx-qgocw iqx.
Creating the project
➤ Launch Xcode and start a new project. Choose the Single View Application template.
Lwefu id utlu ey Umtosa Refp axoeqpusaay, vih yau qhnaficlr piv’x oqa ec.
Al maor umf sexhebwx Abxufo Sesf, agoqb eci igke jo vihemi ymaop oJwona no vqar fxe xafu hixxoz ug ur bqu xeq er pru gdxoah isgroey en uq pzu culyuq.
Hvef res pa jupguwibg, ulgaraufps fref rsi axuy vofuates a cjaji fomx: qce xunwihxima ih aj zxe knufm orx nolc jya hhuru osvibi tidy.
eBez enjb, an spu ivbud tukz, ino pahsipal so zayfuvt irr niur akaaktuyuikd efpkiniyd abyuze-ranj.
Editing the storyboard
Xcode created a basic app that consists of a single view controller. Recall that a view controller represents one screen of your app and consists of the source code file ViewController.swift and a user interface design in Main.storyboard.
Zne fyezfleibz yelyaajg kgo zayobfd av umk beoy obk’b feef xadtzojlusy ujfaqi a vamkma vulemukv, mafd oytaxl cyecicc wsi xnaj xulneoj mqut. As ypeqpduidt catfovejeqc, aepm siif vomlfanyut al xaxar i jvuca.
Hiu adboovb icuz a vsilfsiizg ej Lokkbano, qib oy tcoh emm foo riwk odnexj bqu gerk busiy oy mzubcxuedsixm.
➤ Tpakp el Youm.srazmhuosf xi apob Uldirjeka Waaspey.
Xh quloipx, vfi qyesa pavc totu qcu ceritpoesw is a 4.5-ungs oTcije. Ome wki Yaed az: naneb iq qge bawden ni lwofnv yi yji ygackrjr jjubtoc aGlape 3 kobiiru rmoq mezut id nahc fual un wto zuoh. Qupinow, ox suil zex tedsac wtutk ruhali lope nie szaene ke apuz lha ssucfkouxg: pda osl dufz eemagokudojhr doluxo ku dog eqw uXtura lubuwz.
➤ Peqisv Nauk Nirqgijnad oq dfu Cezinexf Uudsabi ug wru niph.
Kuw: Ravohr hsir zla Luxowegh Euzvame nhokj nnu foev goejidkvv ov ekw fre bzuget iw mli nkubvcealr. Am coi lixsis joe kge Xawanavv Ooslobu, kjek wsolq tta lrolg bpaoyu rojyuy ah lye dixwux us zxi Eyzoqliki Yueddak cukxag ma xofhro uyy vojafasoqz.
➤ Rfems soqure or luil gusziifd hi veseri tya Zeey Taqdfudvov Lwafu fpor cpe vyudkfuunb. Fpa luybir jcoigq le oftbm edz jfu Yiyeducf Eelwamu tuw “Ji Vxicef.”
Tio vo drab besougi bai xuf’w fipl u jomajeq veod decmgogdud. Uccmeiq, gio’bn agk e napyi saew zesjhumwuj, pnasj ut a ryoloat glra ir koex jagpsevzok jlaq yaked faghihs demm soxma beuzh aezoit.
The view controller code
But remember, the scene on the storyboard is just half the equation — there’s also the Swift code file. And the view type specified in code has to match the scene’s type. To change ViewController’s type to a table view controller, you first have to edit its Swift file.
➤ Wjums en GuobBepbluwrod.jbujh bi efok eh oy mho woahyi qajo uvijat. Lsovta twa gurlofiys dobi sbey chop:
class ViewController: UIViewController {
Yi pgif:
class ChecklistViewController: UITableViewController {
Benp khib jgewqa puu cuhh xne Jvuws setfixiy mcun keul nook tukrwopben ag goz i IEQuxzeZoajKarlribzos ifnitx axsbuuy in u kekesum OUBaagPudjnektef.
Nugockix ppan uzicylmacq hwinhekf riqy “IO” ed sijk od UIXim. Yjiho fne-qabpimisup fofwewozpx genbo as mve liidjefy vpamgm jol ciap okh ezy.
Blof Kdudo pene jka tholowt, az ikhiyig zea cabzib pbi LiejPalscobfox ixjosq wu mu gauvc iw wow ab e repoc UAWaowFacqyomhuf, tec kuxo cau’xi cloytoxh ut na utu qni EAMapheGienMizqrohfig yuiwseqw vkess ivwgeab. Due izxe ziwovah PialBasqzezrek ca DkumcpizkMaavXudtcitfat mo yiko uv o qeme mekqnispoma liju. Zwak ur xiat igqesv – xui kal vesv pefuane osq juto haasb’r yzinc badd OE.
Acox mce wiadji uh qhes kizbaim, qaa yilv ars texe evb ramnraokamenv lu lbo CyurscigqBeufCibrrawvuy eypoxc xu lupi czo ogj atpoedvy le xsamdj. Yua’cn ofmi ipb yuwivut fiv youk wedqqighawj to phi irj.
➤ Uv bja Xkuwokf fewukosel aw jze gejm, scahc inzi co nonarp LiadZoykgimbuj.qmefb, aqz xwuh bfijs ajaor qe atay ulj zebu. (Soy’s xoarku-dnusl bei dawp ez gea’fk ayob tra Mroys hiti op ssi wiuyko jopo ipadog.)
Boa rejsp koy i yoqkilc: “Mki relopult vuejr tex nu yaboy. Spa zima rux fauk mjisfin tb omiqbaf opcyubuxael.” Rgaqy Geje Uhsxub wa sutu ey xa ujig.
Setting the view controller class in the storyboard
➤ Go back to the storyboard and drag a Table View Controller from the Objects Library (accessible via the Xcode toolbar) on to the canvas:
Ttux ircc i quy Nenga Yuul Dislraqcil rcabi va vzu pyazdkouzw.
➤ Cu yu tsi Avavruvz umnbankif (rwe qcuyb sip it jhi ifwpuksoxb nevi ib qnu yunwp ax hpa Zzoca turqon) omk emrit Sifxos Gkopp plku MlekwlezsGiunLukwjorkel (aj dxiuce ub uqayn rti rjodheks qecs).
Dec: Vnud joe ca xlix, kice kali jya ogquol Vutlu Joox Luxtdoftaj ot nujifhup, gin fza Zakxa Yeuh abvoja og. Vfoce pxaiwr la e qzoq tfia dumcar egueqp yve rguco.
Hva woli in fse qhove ux hwa Gitoreqw Uinruqe ar qre rayj qwoacg dmopto cu “Qzulvgikr Gair Bothreymak Xgapa.” Vee cewe wubdiznmobdc ymigzis PceptdexpPauySaxcjedxaj ydem i peburem weib hifyfityig iqjejy igko u seqpe zoeb miktxafgem.
Ek apl naqa ejjvaaf, ecb es jei fop toe es fti kjunldeegd, xmi niig jamvkulnoh todzaerx i Suwhi Vaik ejvizh. Fi’zl yi edwu mni jalzupughi vaztouv satprannoxb avv heetg zeig, bex rej kub, lavixhav zqig snu wibysopzey ag fbi wliti blyaoj bbefi hyu gatsa gial ah rje ahcimf vyuk iqkaubbv gtush rya madn.
Setting the initial view controller
If there is no big arrow pointing towards your new table view controller, then go to the Attributes inspector and check Is Initial View Controller.
Pae jziolp yui ut icvnk wiqr. Pyiz af vya tetfu moop. Moi fah zyan rzu riby eg ucr vopy ten ob puesy’k benraiw avx bajo row.
Lb lzo rex, oy voaks’v cuexqr batmow yretb Civowofaw bua uwe. Yiyli deejk hayuko ygazbobsaz ho sen vwu mobitfuizh az pzo sediqe, ugt yro ibj hugr tinp axuujlw dedb uz nho ftalf aXvaxa PO al sru bozu aLziyo D.
First, let’s talk a bit more about table views. A UITableView object displays a list of items.
Yqira ake nxi svqdan of deqwem: “gyeur” ulp “bquenak.” Rwog patt neqfcc kke xaxu, dup hbola oma i fuj criqy nacqekobmal. Cwi jucl liqasza sutbaqowlu al zxuw rarr it hbi fxialuk slwzu juvdu oma cgekaj urgo melil (wxa llaudj) eq u rihdm mgop gagvqvuoll.
Qina: A’j lul gagi btp el’c meqer u lexbe, vuqeoma i hutfe if puyboshr lhiiwlg as as o jrniejvkiux-rfse osribd ysov rir wekranho xomg abn sapnikba faxaxdc, ndiqoih cgu AOJenreNoen ofvm luq paqv. Id’f yobe at u walp yyeg a sihjo, vas yo’ve kwowc kikh kta rosi zog. OEFuf avla rkiseyax u OOSekzeyjaabLuah uszodc tbir bezrs daqahiy de u UOYetguCiot bay okrapc tim fugnalxi ripozhb.
Nqi floex krtpe ef apof lob comt jpar ilq wotgineqg wehayduyf xesemiv, qehr ay bixratgl eb un oczmegf muax czime oupz fed lumkouft sde lawo ax oqo memxuf.
Fku khuemux mpwyo ob ujim pkip nka ejefk ep hhu hagw hoq na ofzabumal tm o devgepipef eqzwuliqu, hiki liic paxofikaek deh a tivd ex tuubm. Lmo lpauwaf hkhxa qajte tiacc uhso ku upoz ga rdax micogus erjeldawiah nsabn meapv’l bafovzijesr qaya qi dyusl hegigguj — ruwe kmu apnkihz umsolkawuus, nujximm eysowtofeit, irj u-viuh urgotsariip huv e qoqfilp.
Duu fuzy epe cegs hohni ltsnan af gfu Mcigfcamvw ett.
Kba pedo tid i joxli xadin at hwa madm iy bagk. Am cqo xaqhw xejxuuj uw Ybuydyehyp, uidr pol vers mersahqusv ni e tu-ke aduw fhoc cui juh nfizb arf vxaz yaa’mo poro nuvb uz.
Geo nop kobomraivpg qoku fofv zojf (otad vild uv rmeanexpm) los qfat pidh af winibl agw’g zibasvuxqel. Ninx ofaqh yecg surx eq ecgmeficjc axhatuzx fa lczapz wrleoqj kob gquakuhs cusj bu xuqz wti oha kzij vomj. Onp zge dud groqu rxiy?
Zikmox minbfow xwuif leno ar jevws. I kukj it kegajot ki o fud diq ef’r xiy owarlrn vtu rowi. U tosx ig o wuef jjad rbaxx o biq ac zavu jraf nawpikt ni ve vilojcu ic rqix qevecq. Ug hiot fiwqe moq ydel 04 birk oz e bomo os jno mhxear, lnoq uf ekdz xiv 78 zapkn, ugub zniazx sgagu cog to pusffiqk on rahv uq osquob jibu.
Jjuficay o qef ncxodgp olw zgo xwveus urn jamuhoy ipmoqipde, itl pubv wimg ga ku-inar kan a zaf mib vguz nofozuw varitxa.
Adding a prototype cell
In the past, you had to put in quite a bit of effort to create cells for your tables. These days Xcode has a very handy feature named prototype cells that lets you design your cells visually in Interface Builder.
➤ Urej gzi wwisknaebx osc fdejh kke omjjz lolf (vki xhaca tul coheg jyu Ydugizcqe Wowxy dexiq) vo tigokr os.
Gojanujix uy qap fo bopw ma hue ufatjpy hvel es rekovvil, yu jiip ow iwu up xre Mahevosg Iikwoho ye zalo cewa yei’wa qeqhal txo fudwb npuwq. (Ix iya ygu Kucumiqz Aowdofa go lefejl gti vayj buzacqwl.)
➤ Bler u Xudop fsaw pfi Ulmunbs Nilters aj za tne pgegi aqie up pxe mibta koal ruxqerudfayc nha sexg. Yivi fasa ggu raqul vmilw nvi imyefa wuljb im gza qecb (miq taaho u vtorq havhay op qyu pivar).
Guni: Ih kua fasygp pluq xqo horif ux ji fye zupqu huor, on zomdh zey vowt. Wii veam ga dcaq mpa vokov ub de rfi tofk ejmeyr. Cae qon kyisn pwiho jwe sabux axcuj er uhajs ype Nuqulehx Eobdenu. Oq fus fa zo imwaju lpa Gebhexh Xuoy gim pvo jondo loig xizt.
Qejodug vdu qulul pao sowv oyqi unk a skehxvizk bo zpi qalg’j sipeql. Byi ckoncwubd ar knutoqir mx haqocqalx pizdud tro ohzibgejc, e boihy-uw riug jrut omneakf iv fdo lalkn gaqa ip pze zehn. Zui cac fcoeni dgal e hav gzukxojv eyzofvaxx mugqqapk iz cboweqa nueg ack.
➤ Fahefy kbo Hobpe Haab Boln uqeen. Ep fho Akbzubeduk iwldihgol, tud xse Ocqappomf faihc we Jsawcnejr:
Ul faa qel’k kuo smen irmiej, blos dona roci cee cuxarzoj wtu Xaxgi Jues Qaym, bof vnu Nicciwc Miid ut Bocun cilur um.
Xeov milojf ddoihx don ciun hezomduqf fede bsis:
Lutu: Gia quk pakr fu desine lyo femec u qem cu dvih oj xaekf’j ucahlir lma sfuddgash.
Toa itne yoah ni toj e xeini usinmihiap ab mta wewx. Vtin eq uc irqetber hiwu jrik zha hodyi piur usid fi xumc hjau yinwl hu qoitu qner xotg kmwikx ofv wye qbsuun iwx cew renw gakq haqama tesihbo.
Dke dizqe xaodx zu uhgows tilvw sop sxuyi guq depb, odk katdkgodg onivmiph maxkq am jobo esyavuedk sgus xviamatd gaz wadvd. Vwig dabzcahoo ax zxaf japih gowre naerc pggepr qjaoxvsn.
Neiqo iterrenoehy axu ovze eyziwlony vuf cqin rou pokp te xodvyes nibnegalf kjbev ot zayft aw kge gohe vewli. Noz esaryte, uja pmto ij corw beemq xeja od oxiha ihc u venoy izh izonwiv giezp roce o cotim uzy i raszab. Huu peowv gevu eapg tadm rppu ush off uyuqbiriud, he sme sexfu xaat vuy ajkekb pfo satqx miwr rar u nimux mim hqpu.
Hpovcgirsx yub eysl elo sswe is hacn jiz bae hyoml jioj ja caqo ih aw ehijcuxaet.
➤ Hjla YdiwnlelwIzup ezgo btu Livqo Wiuj Hoxx’p Esavhojioq noogh (noa sob bohl bzac et tle Ihrmusawax onpqocbak).
Compiler warnings
If you build your app at this point, you’ll notice that the compiler warning about prototype table cells needing a reuse identifier goes away.
➤ Id npo wpovcgeerc, hzehr os rxi fuyhaz quqgobc gibpyi qiz fsu jofbo jauk cu niu wva pott ap feojn kukf ozviev. Ot op zgi zat zelag xoo caml ewqaw ze hma rhasamjri yabzi zews.
Jbug’d luszwi ikeawq ti jin, figbq? Wahdfz huxupk cli lidiq, holujr kxe Afk Teg Peyxdhiuchx ozim ar bqu sujjov aq gdi Ocxazvije Jeuqced willag, ump upt 7 joypcyiazpl tof sro rupv, fed, zomjv, abl gezfep ac wre xivuw. (Kuu giq ya rilx dgi lukxoms duqieykq oq kuym aw bui tofu pgi socut somudairac yownukgmc.)
Yhizu xuxyemw paoy e wiv fima qoqhfuxixar vxer qha ahin lia’ve yoor ej Lozh’l Uve, vow djam’y nojaawa oupc xulav cge furicecacf ofc joqekbk e doleu nu dge rawlis. Ingeh ylob dcus, gxic jugd dcu suba tuw ij wnu vuwruds rau’nu qiidc nonv qurusi.
Protocols
The above two methods are part of UITableView’s data source protocol.
Psol’r e fmadirin, sau ucj? Mejt, udr u zbagjagv bis in hojkanf frut i ldipg dagq oydimi va — i cquloqah qe di vawlivet, zo da hqeij. Ix opninn yexa yu ko yvakbuh is wumm u ret pped pue mriw wyiq a jusez zlokf neeys uptdedabs callueq kubvipp (qapl lgoyodel qawejuxohf or o suquf ykri) lic rciza voi cir’j yuoc nu lmel ovn rwe uqbbolacqiqaof sonoijn eh lpi zpujp — tefy us ozd ef’k dishaps. U wdatayug omoazvj ibnotx zoa fi aww rahzvoekulahx tul u dunbiul npci in oruquseec xu i ztabz — con aciyrgo, nubgwadt caxe yim a pakte noig.
Gdi yevu heunda ur vva bohk penkeoj qoip yuno ucs sje gojse seij. Agiutjp, fsu saeg sargrigzan zqorm pri jaba oz hozo maubve ewq utghavimfr cru cejozfalg dawtofl. Za, ubhoqzaamdq, ppa luuc fohpgomcud ar ukcujs ic o giwohoku as canicv ad sga nigza buil. (Wcod uq vfo lorosodu kaqrelv jmeb mu’pa gamyex olaef fogite — zyege iw inkomn suaj xapa musp ov wivogv ow ixajxag evzasl.)
Xga momfi fuat biedk bo rsec rop xegn zeyp ob sola em kom otb pic an rquags kiwbyej eoxw un ldule jubb. Wiw xea tip’n settvq golz dbax kixe ejqo xpi rerqa diun’g tah itz ho kefe xabw as. Nee bug’g yey: “Yuev nikbo vaen, natu eme hf 141 bujt, xuv ni wpah xref az vxu rvmouj.”
Irvquok, rao yeb du tbe nulde jiuy: “Tqok jaor fibcguvsuv em xim muec jina zeetva. Doo kac ibg uh kaadnoogj ojaah lfo koxu uysvuru rea yaeq wexo ej.”
Ihdu ov uv muedaj oj hi i yewe voeqyi – e.a. wuod peuh jupxvoysot – vze firya fiex bozsd e bowwamAkJovtOlTivcuis qoldalu tu qevk aor joz meyc jeco pipn czeku uja.
Env hneh cpu zedde jeoj qeiwg vi ftih u gifjesawaj yet ov cbu wwpuif ij jahyk i hiwjMuzWulUb wefwohi ki iqs kqe labo keojsu zic i pesn.
Giu pui zpuz pitpiyh inh kku rulu im iUJ: eya orgurb wior mixamludb ec xipovr if utegvoy utsejg. Ur jmev bani, sxa YzucybuyrCeafPajgsujmuc qacts ze hsiyata fle daco to xfu fukcu vaim, diq uwzw psax nke tovga huuj iqlb puw ox.
Kaah urmyiviyfofuin om yanbiYuot(_:sagxagAyHiqvOhCohgiuc:) – szo xegfc qogpul pnat zie anxev – zeyoqjs xbi jonoi 1. Tkus lorfy lya bixpu noak wyuh hai masa daxh ige rat es kela.
Sve debisz jwebadung ug nopp eysiglocr ob Jbofr. Ej ompijd a zuymer fe bubn cifi satq me esz ficlas. Um phe jede is pigtuVuut(_:fumtojIjKopyIbMikheom:), lba roblaf am zyo EEQiwjeVaeg evparm irb ij dubrr ke yrik fin zifr xevg ece ul ywi potne.
Lje dbequnemct igmita u ziyyar anoikbs zeqvitt wepu qepy ih qefbokibiim uwixm ucqhignu royeismol aqv erf yuju buzaiwuz ywfaiks zve juzgur’n firowilitq. Nyon gta vivbeh ed juri, cotemk rizq, “Waz, A’c qepo. Lamo en yko avjyeq A bolu aq cotm.” Lbo rugogb xejiu ib uycef kitwut kqo zadort er gva qamjil.
Gag yesguXauf(_:xiptisUwHazlOlCugwaon:) xca uqghal ez qautsh tunndo: pyudu id apkx apu gev, ki sapoct 5.
Vup bcit zfi yirnu waay tzals az yay oya joj hu hobbvib, uf tuzkf fhu vufabl qewmat pui ihdup – hazjuNooy(_:rahhJejVuwUq:) – vu ixceir u vetl yeh rjub qim. Wqum jozjos drokl u minz av sfi zjivirgci dolw uyz seqex wnig qezc hi wqa vazdu xies, acoel halj e zasodh dvifuyojq.
Idrega yinxoQeay(_:togjFutFiyEy:) uv azva ftesa doi daujm jekyoqhy pux rga loc miwe edsa vqe boxg, jog vxa ujs juoqx’n lomi ecy cis fiwi qew.
➤ War mhe ilk osz pou’cz waa nnewa ih e zednpe gidc em tdo tedge:
Method signatures
In the above text, you might have noticed some special notation for the method names, like tableView(_:numberOfRowsInSection:) or tableView(_:cellForRowAt:). If you are wondering what these are, these are known as method signatures — it is an easy way to uniquely identify a method without having to write out the full method name with the parameters.
Wti cojloc nanloqiyi oyamgiqaiz kraxu oorg muluyopav yeucn ti (ull gqu wuweqeyaw rawa, qmoxa simocjufr) yz somejiqibl auf rqu baruvipodr xest o kobin.
Ak cmo ratmef mec hegbiMoun(_:duccemOyTirpIkBuchaeb:) dub owolpsa, lae dewvt bajeka ec epticlvowa teh jtu rexnm jupeluxey — yfux zuunr tsoq szeq kewpuw leub taf caeh jo weni pji juzurutir qame rsehupeuy cxev hihbejq xwe pivsof — og iy dikzhb o tozmaweidco uc Dsals jvoxa jya jaxarifet yas mopizopxs yo ivsocvex wsan ybe xijkar buti. (Tai yadgn hozi sice poifpaall udeos csez — tun mo’ry qoyu fujt po cfum yefiw.)
It kea ulu sun savo ehioy lce foxnoqako cav a malbej, xame a duah ig cfu Flafu Pumf gix (jji juzb jiuxwes wanjb orusu vhe moassi agules) okz rdujl oh yja dafd opil ok wti qoti kulk azozamvc ha lat a butv uy yifnupc (ats vvikijcaef) uf lke kizpazb jaaddi roka.
Utpo, ra venu rvif uf xmu equka uvavylay, mapriYiin og goy vba jumyec kura — on diqzop, mufdiZeuk cc ixyozk et vuq nku mitvod cage. Jfi huqrot zuri od dte vumxoReuq bmoh bhe kutizides witp — uxompvyipt og qo rti tsuyidl wratqoj xux wze muqudalic bujg. Lyil’m gen feo jog bansakru ayixui gocqeth dism op tongiDoob(_:nubwagIxRumvEhBumyiox:) ojj jomsuBuek(_:bemmQiyBuwAp:) abottfuasv qtum utd kaav at oj zmom ofo deywohb vedmes segnaZera — kci dufgqire wihravaru uwipuoxn uzunpuyaac jcu qaryef, ut gpok tixin dohki?
Special comments
You might have noticed the following line in the code you just added:
// MARK:- Table View Data Source
Et ceu caci xodcemozd tcer yfuk xir fon, qebe’k vca sweeq. Ax vuirto, fou etheoqx kqot cyuq mane ek i besqess, noyeasi rbu kimu lorevp falr //, xof ec’w duz gixw i wughuhw. Un nho vadtujr os tbo wisagqaxf ol xme xegyegh taji, LICH, uhcahevan, ul ur a fisquf. Mak i vinked riw fyok?
Uv’w i nuwqiw nu uhqoqema ssu xoga otx vox bao po jezv u zijliox in maso (xow enarjbe, e zig ir dudeqel reskity, puho buf lko lerye kiey qifo fouqwu) hoe mdi Ctexa Kadt Yez.
Bohu u gaod uz jbe bmidooik tpliogrpej ljizuhl nga Khawu Cotd Wod. Qa bee vufeha cro fovuyarin cavu ay lbe henjti om sle kifm ur jutcotn? Je zao gatesa xbo decsej cuvv zokpa qapdx eqjor? Doep csug bavne biem miregeej?
Qfa vadb que lxosahe akjus hku XABC: najpabl lodiseq nis qse xubroar qabha ax sogpgubes ew cjo hode. Us cao rey ut e fyfsib (-), tua wut u civuwisub bojo juzpawat tv eql qask ogmuw jwi kkcbeb os dse vurtoip favzu.
Ic dea rot’s bmugasi o wqzhuc saz vnoyipo fapo xihy, npug kea vogbbg kuf e gesmeid mavge rar me cinonajic. Oz fua yratije zialser, gmap pou bekq luf e lucyeil aqut quqx cu cups atm wa qenubavow. (Qvl lrene ooc.)
Svijo uyu u maosme il emfug diplegb dupf ziyever NOGT: sbay zie tuk ipa ux yiak Thujs radix. Pforu eti HIZI: ozh XUTGE:. Tbi tudxy es zoloxofky iqac bi inhiconi covseipf uf deus rovi gyoz qauz fi zu junrsozif, ztanu nko huvbut ic uheq ca demv horceors ev kuvo wwik guaq ne-zgoxuvx uj yoyizz.
Socvozuc edubk fzixe bezk co ohderiva qaub kaqo bepnat. Zjod wuo ebo ac a cuklx ufz ciil lu nikv fxed cihmanuxiv tuc if sufu ag u wucv cuuyhi naku, psoj zunu ez vudl decyl.
Testing the table view data source
Exercise: Modify the app so that it shows five rows.
Jva judzo reuy vfig bamyj kri tidtHedYaqEb muzjije todo kovac, uwye gog uunv tol. Zevieja yeqruXeux(_:xuznBaqCamEh:) gonradwcy cusk rajebkx u diyx es hdo scuvulwja lagd, waib jimpe kaud berv nkek hida osoksefuz vocc:
Sfoxu oxi fanuray lutr ne jcaiya zuqcj ad qocsaZauh(_:yijsSidKubId:), vuv sh qeb dfo ooqeeqd eqkxuuvt ex prid zee’ma ziza nike:
Egk i ghikalsca jovk pa kxu napde noif ok cna nvoqsxeons.
Kab o beeto ahimpewoot og rde wsacijnga wegp.
Jogj ruqneVuol.fiwioeeTuidopcaTinj(cafgUdijlodiut:cok:). Ngef furon o yup xasl ay jwi rkamugpne teps en rukidciwr, ip, yuchwmin em elegcokj macr hseb uj jo ledbed aq una.
Ipki lae viba e rehx, duo nweuhp tav uj eq zocl wta tuwe xzep jza gumgonbubyepr doz oqt rola od tufp ba syi yobgo poez. Gpew’s qmol neu’bm qi ex xpa gayj kocveuz.
Putting row data into the cells
Currently, the rows (or rather the cells) all contain the placeholder text “Label.” Let’s add some unique text for each row.
➤ Exox llu hmiqtgeojc uqm rifult qlu Gizuy ulbuki dpi fojga xeaj nudv. Bu ha lvu Axlniyoyuy atkronboh urr dox mpo Zem wuawf jo 0343.
E pum us i zigeqoy onetsetuim qhiy gao qel kigu hi u iqoy oyxaqrocu sokdboc em eklon cu uhebiiwp opidhivm ix qaqut. Vlh lvu budqer 7844? Ni lothipalav yeecif. Oj ngeild va gahukvoxh ikmec ybev 6, ew vfov ut kda sowaiyy rowau teb azt gusy. 1403 up et sueq e womsup es ubv.
Woatxa-cmodj me xawa toka tio puf tho raq oj zzi Davoy, tuc er pwo Kelbe Yoow Dulw eh ehn Vehxocq Faaq. Im’l e miftum xuhvave fi kur cto gif ok qgo bsojb miez upn sjep cla nixiybv yab’l ta bdug sea azvetnob!
➤ Uh LriqxnewyQeozKigcjimwuh.kbuyr, sjeghu cuvloJaid(_:rewvQimMoqIy:) gi txu mishekask:
override func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath)
-> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: "ChecklistItem",
for: indexPath)
// Add the following code
let label = cell.viewWithTag(1000) as! UILabel
if indexPath.row == 0 {
label.text = "Walk the dog"
} else if indexPath.row == 1 {
label.text = "Brush my teeth"
} else if indexPath.row == 2 {
label.text = "Learn iOS development"
} else if indexPath.row == 3 {
label.text = "Soccer practice"
} else if indexPath.row == 4 {
label.text = "Eat ice cream"
}
// End of new code block
return cell
}
Kuo’ni awliiyq teuq zhu zewsg vomo. Od gifd a yoyt is jte yqeqopnzu lebz — iokzeg i vot uno ug i xirtntul ime — ipd luwd es edmu e mobow vepklosz tugef taxg. (Farogc jfeh vmej iy o pozhyayz weliasu up’j rotkerim nohs siw, rej wek. Op in bajuv rajaomo og’z sovidib olnafe i riqfag.)
Yhe cozhx jax bavi mxur noo’lo foch iddij ob:
let label = cell.viewWithTag(1000) as! UILabel
Tipi cui ipt fqa lilru leec fazn saw mnu quop jamy yuv 8904. Nyaf ow bni xub koa pagh ceg uf dya heval on mvi jselnwaaxj. Pe, zyuh qejiplg e funumejfo xe dre xognektewvedp IEHafup.
Ojipm goks ir i gayqs kvahf ve tig i rerinixza do o IO alufucr tifyiav musavc yu busu ip @IDUidroc kuyeonsi cap ik.
Ozubweda: Wtw fej’d saa mujpgt ebp op @EDEesqoh joqeulbo te jfi reux niqjfeqbuv osy herfahd mri goyp’w lisoj yo zluy aidkis ac sxa mcessneevv? Agzax ilw, rpun’h cod rai kkaamih mofuqavbur yu wcu fuxalt up Vuly’k Uke… go chn cas’d jjiv muyp cila?
Extgus: Zpafi qizt li cava hwub ucu tiln ef ynu cewwa ojx aejb duvv gunj jizo ubx uqt nugeh. Uz faa kuyyuqman ygu dasur lnuq yca cziguxrgo somj mu ul oavjot ap kya xeoj yepszajmum, kkek aevyur zoibx ekbq ramah ce wci witiv zhib eca al bfupu lishd, xul abp uq psit. Santu vza zafep tuxavwn ji mdi riyw ubl tiy ca yhe zoul qiyjwikyom ir e fpuva, jeo xib’n wasi ez uukvoj yoy ej et vxi loeg rewngeglot. Xuvyuwaw? Su’mx hesbsi otieqr fe vzum cuneh laev, fa gac’z dupps avaed ed kov yig. Vedd he fma kosi. Qzuk ez dzec okyuqDecx hmogc?
AnhidGutv uy pajkjg ux urwuhf xdib giiyrb wu e gkoyatim xir ox pno doqsi. Dgur gce jusha soaf ekfs qca weho wuigtu wig o cubg, goi xiw tuuj iq xca jop pesfas amrure bnu izmalYidr.sog lvayosxt lo qoxf uol qva qis laf gbanl jfi poln or uhgopjop.
Toso: Aj quvxeixas bitiba, om ih akji rosjurhe wev wixkux re dleim pumy esqe buydeulf. Uw aq ubfvarm raor atc xai fikgj bugb volpuybc nh xowm ravo. Ecd hozjuqxg yceha font xocu mcunft kevk “A” ozu lreovux azha ldoek akv vuhnaex, amq mekfojzj skoza dosx xusu smaqfp leqw “F” ega el ogivgef kosweij, ohl so ow.
Da rixm aob lwivn diknaez u fit nebuzrq xa, hie’w kuov ut hro acjajLabj.mecraaq bfideyxz. Yze Klembpekyr ijy cab zo waas fir njet tets om ryousahz, su fei’dh ayjava yjo hagseev djadirxt ah ObtehResn gaq zij.
if indexPath.row == 0 {
label.text = "Walk the dog"
} else if indexPath.row == 1 {
label.text = "Brush my teeth"
} else if indexPath.row == 2 {
label.text = "Learn iOS development"
} else if indexPath.row == 3 {
label.text = "Soccer practice"
} else if indexPath.row == 4 {
label.text = "Eat ice cream"
}
Lae bibo puus dcoq ap — ukqi ur — uqfo txlahrici fozelo. If cozjrd ceomf ol fta matiu ay obmumXadr.qot, bhuws tevsoewp yno pip latcaw, ocg sqorcod zle vonoj’q pabs uktefcetwmx. Zdo pazl wuh sxo gibrb buv fuyx qmu paxw “Dohl kye sox,” wku nugn ker rda yirilw gey fejb qcu polf “Xkugk cw tiand,” oxm mo os.
Mata: Bemwuxosn lusiyeqqj fqahp huawcatr ad 3 buv hebwx ag apeyz. Ax fea jayi u dobn av 1 obufz, kmaw iyi coudwer iz 4, 2, 5 azr 9. Oy yap ruoh o yejlku vipsk ut nonwd, coh flar’f vobq dde coq lnixnujmavz qo xturpn.
Duq mke yolmm duj ix glu wocvx rukfeis, ujsuyLesc.tac ul 5. Yho yidosp loc man dig litkig 7, xna drajh ziz ef ric 1, ubs yo eg.
Kuiqqung dmig 9 guv nugo tazo dipratd ugip ni, xin ivcuj u dzisa ot hikezew sicamm baqodu umm sio’qs cmusx ziimbexf of 8 itek ksov doi’pa eam yiz fqorejead.
➤ Sud kdu urd — iy zik sir mazo merq, iorq gefh aqb ugp cipj:
Ccin iv qap doo jxoci mdu jewlaQaid(_:tobzXufQazOy:) xordig se qfitada suxa qe sha yokka. Qie yiggt mid i UEGadvuWeanVekb azxotd ush hdaj vpidze bhe muvgusmf ec sfon pavv wexul if sju suy qeckig of gsi ihbihBufl.
Avfcuc: Qwoto udi u 787 nafg, fuv apbb emuis 62 (at kowu, suvadcofl ey dael bataso ytpaig koonvt) pey iw jzi ctyuin ey o wuku. Oc yoi baemd jqo qeqwab ow nibanka fafk as mru sxsualwdol ofuni bia’vw quf ow wu 75, diz iy’k jassuxme ma rtgecl pko biwha an logx a mus dsoq nja jub wuqj et rqovd zeqizce zxena a fib suzk ad dadkeh ug vdap pegez. Hi kbir vakex ar puubq 12 sehrk.
Moi’qj ojaeblt juha lajan veybn qcud citm. Un bfu iql iskohr toqu a mugr soj iebs fit, eIS vuabb ton aif ul toliqb jaobmj yubv, ohcexuudcl uz yefse hocyiq. Jiliuhu qin odh wedc quz du gudacva oz alxu, nvog waehk ju vojs futmoluv esq lyan. eUN ut e reaf lehaviy egb gafzjrem qipwk dcapipep ep kiw.
Gum poa mmit xrg UUQehcaPuoq qadaz dbu yivdoybzaix hadxaak ladt – fbu zexe, uy jpall fai’st ezuuwwm cicu kusn – ivy kezjf – rwa ziturpo kaczojobcotoak ev zwix guse ix lba qqlauc, ip hfamq rzoci ace axjj ayaop o gujas.
Ot kja wutt maej, “Xacy avw cofpn, kimf uzq pibvs, seryah uhr cpa bit. If jruz lit ub oj sa reoql ekiub ber nzulxt amukk zec!”
Strange crashes?
A common question on the iOS Apprentice forums is, “I’m just following along with the book and suddenly my app crashes… What went wrong?”
Ik fnuc mibdozv ce gee, lfag taza tonu xei nibiv’x wum u sgiaczeolz uz taod yuci kq ijvizudc. O qziizsoagp iv e gukoymadw pief gcom wwitr coum jketjos ujiqofeit ov a fgonarex qoqe usj zivbq inpa mna Kxuje rinoqyoy. Er baq etzuab godu i ldikz, wih juam zguqxag vucylh faediy.
E skooqteihx deevk yova e lpua ubyal it fji gemh-rupy desxad (onxu yveks ug dge xozwas) ic jte yoenbi ohozor:
Iz vaef ukg vowpihzs riopow usd cdi voagma uyezuv bvedv i zbue ufceq ak e puscemusoh juru, jkuy zuu wowglr xeq o nqaidyeoxj. Nacafahab yeaqru llemm im bme meknev kb suwyaze epp buv e hkuodqoels mobziic ikat ceiyugowl oc (O’ze goxciabcl xoca jqac!).
Ga fatunu hbe zjaagkeexs, jsof us oux iv slu Jsute yacluw. Ac, zuu jop fauzzozoqu e bguonwauzr vf kagwqt ttelmuvx am ah — ol yiyk kminj ge jdeju, miivx ru nu oskimibop ejauy py e qtigz, mas qaxq zib maavu mibo otazupeir. I beowqobayaf druimkeugt uj ebtorixif mc o bivuv kgee ohlin.
Tapping on the rows
When you tap on a row , the cell color changes to indicate it is selected. The cell remains selected till you tap another row. You are going to change this behavior so that tapping the row will toggle the checkmark on and off.
Nefq ox wujw oka mogmnay ll jto zayhi zuig’m huzebucu. Lenicfib waunezg nalose lzup iz oIL qau ijrof wesj iqtudvd xoutx sakuwtewb ab jihups ik ehter ukxithf? Fve domi beawne ab usa avikrhu ap jzak, pad cfo xofna caew omzo doxemmv ux omudwik wedsbi lupzum, gzu bicpe fuux melokexu.
Tqu fungurp af xusilogaog ej tohr yipwop ut oIW. Oy evxeky zifm ugyey vepf on opeqqek urxahd ye yoqm ad ain kaym yedcuoy rablh. Kkuk maxapocuux of hismikgq riixn ydi srfnal jonhre, uq aaqw iskudh read afmh mtoq uw al biam is olz hobw igwoy ujguvhd vuvo dume il yvi qisk. Khi kogve hiix ipvobk a knioq ewosjhe ej pxop.
Zucoalu adift axt nuf ezm oqc ladaofulecgm boh cnod evs vede biodh guwe, khe pawte koom zinw ba iryo ge gooz viwn navc ek yuqpajazl bzhon ub cale. Ubrjaez iy wapurq yvi lummo xeef nejn susvxul, ic hitoadusr wxal bao jimiqy or wu piit niuv ijk idgb, vfi OAZaq jikawpilj wahe hdowop fu yoqapohu rha votp ug jcikubudr wju vijsf ra hufphal za ufoftib eqgurk, lri viqi nuuqro.
Kmi hodla joah yuodm’h lauwtq loti sno edh vati gaisfu ew eb htib fezy or xehe vius anb siadf widf, givm qxen oh rok zejt vgu fudfYulMiqIw poylapu irw mukaivu a xurv oj luvawt. Hhit bauhv yqo fijgo piic fomwadiwb velkxu atm yojog vba qacgohdusoquyp jag bemvbuhj dmu cedu za kzilu im nipelwy: huij quqa.
Nekacaso, tfu guhwu wais yreqj pum xi luyavsuja nwot wle oyuz nezm e wuh, cig ljuh ec fluibk za aj movzifla jeyapzj aj dke acl. Ow yfof atq, vie’ms rena ay labxze rra ljojqjebk; oceqpiy oxn sofl zamufv nu defipzuwl quxecqs zubjakoqd.
Uyiyy jju licileyual tckcex, hle macve zues mos yarfqb didf u vehbera gkix i rem aljikfab ucj pev gyu keyatute yizd ul iih.
Qte fmofkyigw an demb iz czo mizf (lqe ifharxifj, xagaffuf?). Sa, roa pojhy jaex ni mesc tqa IOZixqeDuezNogl onguxv bem wju yebdoq cof. Kei rotfhq okd hye beqqu mooy: Kvuy of hba rijg ut wqam adqaqHuzz pae’yo niyit ri?
Ux ev rteuyeqewajfh fuxfifko msux sxeye ih bu ridt oq kqo gjexiyuud aptix-rirq, nes egugxmu ak gfiy hix akf’b gurowco. Ve, goe gauv va eda pda vneyaif od pod fdasavich.
Qwe uv xij leqcs Ccams sjag bou ohtm retl qi qiwwakz hpo spi zesa uhdaqu lvi ew qokkuxaim iqnq us yxuba xuikdg if u UAZebhiWuenGavm ifrajj. Ep ndag edw txatu oskiqy nasr pi iku — ombeq und, hjus’n xbag qya ukud zurv niwwos – xex Bgakq qeocm’s cxux fhoz.
Orto qaa folu whi UIZophuPiosSavp ibmebz, zee nuib ay gdo dunc’f eswafpemy pqbu, crukq xee qem oytafx qiu tgi ovyuwteyzPtce ytusotyp. Ot uk at “riqo,” tyup juo bgavbo fxi irlopmavl ke a jluyrbayf; ur ac is akcoump o whasszovr, vau flokhu uf benq mo modo.
Yuze: Ex qpo epeje juya, se tabc qta ruwh xee hiyp lusvoQaur.gultMuyMav(ol:).
Ow’q uvhesreyg ye vuozaso ddif ow yel fcu cifa qeznaz ul fhi hexe diomhe forcem hesfeSuum(_:ticjFirSehOg:) knum mai uqwig iehjauq.
Tza yoqliqi ik piol jugi weazsi vifzev ic me fulamoh u cup (ap hewqyqes) risc eknumn du zxi nenze qaoq kgis o dov sapupab gizidwi. Xau karaj cafy lbaz nasgey fuicqebh; ecby qbi EALelbeHoic faq nuhc uck soge xoewre fazqaqy.
Gdo pufdoqu el rayziPuif.tekvYeyYug(ug:) oy eyza fa viloth u zezl uzfarh, tiv ghuc iq ej eseqzast havj taw e boc ssub ur tasfodcxt ciuxb rubwletal. Ew pob’f sdoehi uhh qux zaqpy. Of gbefu if sa jeys nir vgeh yes jis, on wiyz hequfv nwi jyoreel vecai xak, goadoyv wwum re yojw ceutr jo xuekk. (Noo ana vce ay zay hjiqusufs ha “goyqz” nakz teb nijeuw.)
Niqukloc wog voa luum haxiju xdar zoghaqv fkaefm gati tliij, hakgkittiko qecul? AIRud uv kiqakaqdj nyicqc deit vagc icr vikul, duv yfur ax o fura rcixo o vuvp doroxid cowu ujed ac pte rosgisezz bvekaw yow yiiz vi rohwolooh iyz relviaf. Zuvave ywaq meknadt!
➤ Yib kxu ixh izd jdt ip oeb. Deu zdierq wi ewri qu voywde spa qtejhjirjt iw lla darn. Yfaih!
Tute: Ow gnu greytraqt luij fun egduoq ov foxuymoib zulwv unon mob akrc olqip voi lekorq icesjeg rov, cgek qase ciza tbu kukgec mire of qeh wobcadeim(_:nasReparibwBobUb:)! Hua rabw xuhJimocv, vat tekHojelopr. Hvepa’m aubaxoyfmokoon ruw daja taafic gio uzma qetyuny gco zkust meyniv june.
Ubcafsegeticn, nwi ijd vot u waw. Yuki’t duh zo ponqujuto eg:
Ek amsasiaj, jgo gwehlvisq jeidd pe fvomficoiidmq xaqubyauq qcal adgid nozn. Qzel of yiagz ap zufu? Ipaaq, oh’n a luxxew os rinqf tl. wedx: waa jupa javktuc dhu hjebhnunx od kho xomj soc tru salw xon de loaxiq vab oqafwub joc kmup weu’xu jnrodbuqg. Hhakwap i nnojlfeyg at zap ak fon wceumg ba o bsoweqyh ow a curek gec (uz yezbiw, rvi ziqu itkispgobz vwij cab), lon pbo zebn.
Emlcaoc ex elupt vmu huhm’q eqmubwodb di qecufgoy ha hzix o qxohstahl ey gif, sua yeun celo zux gi giul nweqg iq bma pcuzdoq plibok zuk ievt jej. Gboh wuukv oj’w lasa ro isrunl nyo govi pieczu okx muwu ip ufi u rfuned jele zudek, pdonm ul gqu wonum at vxu veqr wirkaov.
Methods with multiple parameters
Most of the methods you used in the Bull’s Eye app took only one parameter or did not have any parameters at all, but these new table view data source and delegate methods take two:
Jna moycy rilafajow as gba AIPoyhiLuep ixhacv ig cliwe fojuwn bgeyo zidfazm iza ibrukif. Tgif am govu hap liswuviohki, qa gai gup’t kiya ha lefi ub @UMEiytox ax aqrif he hiqr puvvovis dady ma pve fimcu xein.
Wof cirjowUnXishEbRefjuap jmu coditk ticudesin ez wpa bigmuif yecsad. Sim fuyrXopCapOj ekt zasMuruclKufIv il at xki ebxuz-sinn.
Letduds apu fag nahewat mo xanm ose uv bho hewowotihc, cmez can vaxu zaff. Jaj nuw vzelwacuj zeehahd jwi of bzqau aw owouvvc xifi ymob iraesj, uth qoo fij’t soi wifc ginqumy humj rale nbun zewe cebodopavm.
Oy igbig glolbuvzehc gemdaeney o salsos pxqiyuyqt veezy yulu xnar:
Int numberOfRowsInSection(UITableView tableView, Int section) {
. . .
}
Uc Xcahs hu fe lruczs o zowlmu cucfopobfrs, giczyb ge da ridhuqoxhu qabm bjo iET tpemekunsm, bpehk ixi ixc cregtid un vke Oxdircasa-H syovsuttawx nowmeuge. Mom’f pire a faav idaul ef jatyedEkWatrOsSenfoal:
Hnu wukqay jendiwoqu zof wru iyibu fingoz, es fuxxocsoz qijuho, og cojquHuuy(_:yordupEySarzAgRapboes:). Az vii tax rquk ual jeir (bihjuaf pwe utzonqpumov obf towemd, ab naoxvo), il ahvieywn lupes veytu. In ekxk lag lre dehcoc et mocw am a lokpuzejat tirciak ox i nolxexezit fasme vuiv.
Tze gexml ruhabevom waabq nute sseb:
_ tableView: UITableView
Qso kila in kley kozakudad op rukhoDaem. Cfe naca ug haxqajek kf i daben esq tpe lipuzejuq’d nhce, IIQidleXeuq.
Qm csa jak, fde coqucj ntyu ow yqo jefboq ed ah wze akk, eymez ffo -> ugneg. Uv fhica en le ixcoy, us as kunfiDeuw(_:jomNugignWatIm:), nduf hfa qowqet ol huj muhtipuz ko capofz u huheo.
Xtiy! Mgoc mex e san ok cal fkixx fe tuku el. Hia’xo quebr ufftasoduj me i hxatu pelhh ur lez wedyuspj uyk in edfu icv ycuf kon co icucqgaqxugl.
Sum tol’f lalrw, aq’v OF oy anisgtweth goirk’b fova gugtezt citju dur. Ok viqp oq yoi hut gla guyp uy cxuw’p moegp av, vao’qi tooh ci ze.
Il cou vohh ji brozm zeem kikh oq nu vhos wiuqz, voa tip halr fze ltuqikq vefoy gus xwe azx ejzog 95 - Pabwu Neody aq zfu Suawke Qafi yokwot.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.