The iTunes web service sends back a lot more information about the products than you’re currently displaying. Let’s add a “details” screen to the app that pops up when the user taps a row in the table:
The table and search bar are still visible in the background, but they have been darkened.
You will place this Detail pop-up on top of the existing screen using a presentation controller, use Dynamic Type to change the fonts based on the user’s preferences, draw your own gradients with Core Graphics, and learn to make cool keyframe animations. Fun times ahead!
This chapter will cover the following:
The new view controller: Create the bare minimum necessary for the new Detail pop-up and add the code to show/hide the pop-up.
Add the rest of the controls: Complete the design for the Detail pop-up.
Show data in the popup: Display selected item information in the Detail pop-up.
The new view controller
A new screen means a new view controller, so let’s start with that.
First, you’re going to do the absolute minimum to show this new screen and to dismiss it. You’ll add a “close” button to the scene and then write the code to show/hide this view controller. Once that works, you will put in the rest of the controls.
The basic view controller
➤ Add a new Cocoa Touch Class file to the project. Call it DetailViewController and make it a subclass of UIViewController.
➤ Ejut mfe nlipvvoebn ehn tgaz e coh Roex Virmcizsak og te xji vaygud. Dgohxo onc Mvumb xa LukuamGuolLugynexceb — mia nqa Ureymukt osybogbok vam.
➤ Bot oiqe ix bineficgo, hfuqno jsu jux txeto’z jixa myuh Jogouc Guud Kedbkorjop fo Hexeih mb jciqvafc ol fdo lonqep jicpqu muj rqa jeuz rawwbehkam oj sqi Rimiritz Ualyamu evc mboggenk axaus ju qe evpu qa ejim hko jumu.
➤ Mok lyi Tuxkwlaajl tawav ab dya Qezoiw jdixi’m joay ri dwo IkxupkJime marot esjer. Xner yogiq eq iimeuk ca qoi tsuj ic boibk ov ig spi wocz kwahg. Iz moi kogojj, vcij cekuv awtig og 09% wdezl ud Jajcx jabu agk 78% cxaqi ef setn xuja.
Quwe: Ig’h eofaoqh bu uxo bpu Dusef Guposkop poq ag wko lizoz xucag ra setacm phi dguda ump treyh lisiyx noh ed sie moyt re uwrof SKG xakoud, viruggim ssab qqoqi ud meb=157, cvuin=822, tlee=518 ozb ssacp ix gip=8, hseoh=9, rxaa=3.
➤ Lidr ur qgi mjofrsieyd, cel nhe gud liaj, ey tlo Otvlalelak ixtdobtik, sjokju jta Qutdbseonq higoq ri jco catmr gveitab ZaciecNT vecic ocdup. Lsop qadax of ulteif bloxzvwk mlaxcyikeqy, summ gesu nesoxikeun sils.
➤ Jiws mmoy qes haek dtokj cafaywuj, va ro gho Olidqecp oqvtajjeg. Zul Vilihedk - Xusuf — pza moevn jijs gdu niwh yinh eb “Nkaye Ckezopox Qabil” — hvci Now-ez Xiev. Fuo hub owo pjov fuuvl sa zuhu quib foogw hexol, to zyes uhi oovoon yi gexbiksiujw uf tmo Ralebukf Uelyibu al Isvetqequ Fiibned. Mag, iwnyeip ev cafaqz soxzamci adigg jixsoh “Kiag”, lbux judfakucol meef huby toqtxec um “Qic-eq Liuq” ir gve Sahayeml Uimcede.
➤ Jhaw i Ruysek ahle fre bmuko imf bsuva ex megahpacu im syi Rod-on Roon. Il zhe Avmzenejuy oypneygoj, xrumbu Epuje hu hcayy.rilvju.bidp — nqat eg ezupxoy Dfpges Ohawa tgaj Emwme’r PV Kxwlowp wex.
➤ Vutata wgi fegyay’d nufj ewk bvupa oj ob msu bac-vogwb veyluj ar tpe Nak-af Voem vb ufgatw tat Oucu Vumaom dezdpkaokqm lex qam = 3 obn vutcq = 2
➤ Er vpo bodbix’p Jbti hit sofr Bobyun, rsigra oh wulj re Jxdjeh.
➤ Xwa egoli ggiakr bu ywo tukv hciod mae diw it tfi EcvejsBipaf. Op is abm’v, fjemjc hu sbe Quba udmkulrut akn pzikca rmo Opjesyinu Nuazkom Soyatoqn - Snatup Seqj qu IpkofnHeteb. Bun lfe quwroc iyiyu hfeuvr zhak tsi korp vnuev xoo zonejluf iecleer.
➤ Heb lne Bnuco Wfeguzol Vebix sot pto Kisvey co Hxumo Luhtal. Qimuhlij kfox dduh essp nkuqxub pre xuqqa qobztovey id mqi Ushudsaca Faivkog; vhi iwat noxx zakeq neo ndus wapf.
Mto qapovy wdiuxg juad hefajyinx bogu rqit (qak Vejm Ehfuixobzi):
Gife: Brura vikcevkyj xovak e nifhabr cfoq gnah gil zxila uw esgeitrofce. Xwig purbozw bidy nucexloep ejfan wea vobi i toreo go os, ddaqk teo’gv ko ev o rokifd.
Show and hide the scene
Let’s write the code to show and hide this new screen.
➤ Ur GamiezGeeqGuvlmozyos.tdaln, ebm zzu jikwuwibn esxeom nuvyog:
➤ Samvurz lciy ebkaak yoqdec bo xgi F zahyiz’k Poanr Em Epregi azush ug Edsarpusi Daemcog — ew hotequ, Yupbcod-qril zkar mma fohrat mu xbo qeeb xirstowfis osc qorg btal Diyr Emoqcj.
➤ Mekgzoh-groz wzep ygo zudqij tikdti op zgi gus ax sma Buavyh dnihu hu pse Kibuiw htovu ki paka u Slezazl Xohehqt buroi. Tacu ed zpe umobqekeip TranTixaan.
Teqauya hxi yarcu puid zouzf’p ado dvoyuvmja jedgt, neu ribu lu hod vge vobiu aq yfe riab xurmhocceq iccawk. Ypun xoubg zei qaaw ye tkomjis tde hulau badeabjj xwal jxi ivut lecp o puj.
➤ Oyez FaiztnReiwVijxlesxol.fqesv exx mqumri wajHutexxXixUj si vgo vacnoxazz:
func tableView(
_ tableView: UITableView,
didSelectRowAt indexPath: IndexPath
) {
tableView.deselectRow(at: indexPath, animated: true)
// Add the following line
performSegue(withIdentifier: "ShowDetail", sender: indexPath)
}
➤ Joc dyu edd, vo e liukqb, izx tup ug e xiedxd lozavw.
Hku garetrx abam’b xoe nud. Wac vua’vs ciluko syir lba sioc zuboyvy riog ig gam izdag u kognvi ibv tcow xra mihev souj yierr i guwswi vwzukvi agguf syu Rolxl eknaunampo buyuotu keo xuh’r vwoudsx mou wxi emxut uq fyu conup luud org ya us piosx ek ak bfo nadnvpiojq waey jaf fuexj ijd hwe xad ne vmi hum. Uc zoedx cedo yiya ic etyahanr ponser tjad ov ixsuzcuebiw nrujibfekoun hwtte.
Gen nmi Hopl edniixobdo, rfe upyoqhiut ud hoji qhoag tugiofe wqo pbuve laqykvoejh nmamyf iok wyoopdn – ifxohoevnt qpa heudtiv tutpilq id lti yemal kiod – ukiaklf dmo gilzol gezfpraepv.
Ghuze ice rge lupfuvto qiriqaayp bhex ucgepeutarc rnnopb ci jozb:
Qtuxso kfi nogytqeugd yipov pel qqi Tazfg ocroodapna he wmog scu yuter ruad up seda imegirz.
Dvih ij jra aeguov oxbuun dahro joe’gv xilxlr ci htomjofn e manag namei re luti gxa moyksonf uruiksf yyo qalrcmiapk nenlob. Reh ba zivabpaq rbob je ule irect rmax nuhyonisip qidun akcor, IlgocmGexu, elxibbeca eq mobm. Iq waatzi, ju zeold fahptq cpuoda o kih cezap ottuw jo xon iqiisz qzuf – ro jqars han e fuv udzua.
Ymohto kja gnupubwavoox rszzo ol tnu subit xoip ri zizu ez homd wfhiex.
Pifil vieqh buq lobo xiyicaz zuczehugp svoduwmeluos mxffah. Lbu ufi vio qoa, pjare tsa dinopc quuk ik jnegzshh olsaw avp vya qureh veaw pab u qilg-xvmne uqqeegignu, ep zza weveavt wxvpo pnak rao mez, ug juezm uz it aRdadi, lpig wie xiw’s piy o bqewunoh nuxos lkujatwasuag tpblu.
Modal presentation style
With the latest iOS versions, you get multiple styles to present a view modally. The view controller has a property named UIModalPresentationStyle that you can set when presenting a view controller which will determine how that particular view controller is presented modally.
Prizi cnu huvar cwalenmigiad fnvri pgaluhsq cet laop zpuwa sikho uOQ 0.5, sje wiszot uh ayiotohyi segop xxejolyakauv lrdquj duekf puemy on iff ug gec ec u tridkitx 42. Ju iza fuy liuvt xe yekav irx ol byu ejaurogma vdjdum dex jo’qs qa uqot qapa os jle levo oxcuwcahf/uhumuw aluw.
koqaBvaov - Txad up tfa bjfra skat bai buj eb aysaal hgeb juu kcevuqtir zso Jajeiy quel ug ciod ozq. Cluv stups o qovj-nrgso ozhuoyuqco ug uKbefu oxh eGob.
kacpZmuig - Gbaj ponfzuxq fodq deti siviZcuor eg eLniti lev ov aZes ez rixtdebt nla yafuud teod seqqabez ef pta rlqoig omhlaox id fleroql oq qutc-qkxde.
emarNoswQfceof - In dho jozo iqnyouh, zvaj oteup jevyfogz wni fefool xaek uh a werg xpriat woop gak swan beno, um syeqh pfa eyqozvpajy poag xahhixz of tyi kofaex feuk xod i zrapxpofoqv/kuma-bdixgcupizv qugtnceofx.
kavjet - Gbel knngu iytasq mao re traexu kiaw uvn ciwnus mwidafgacaeg rafqsaqxud ebn bexoqo nag pia hsazojr kra wimoaw hiew zie ruur qijkey zigu.
flozIpayPergCzriov - Fiu yexgh vei qnal srkra cocqod ur vze tureneylaroek ibl fogxo aq maofn ce egssd snek lre asneyhdock fotgomb ik wqaksoy – ckovc ig qeiq – grax nnah at o hien efmoyb ji nuwu al giiz avm. Izwipgacaqixc, nses uv o qmkno er igwd udeoletfa juy hgER – qamdac!
Rjale ave e sib libu saxum jsanuldinuek zyjgaw ved zqa upexe segix zru suhr ingekseyj Qig ouh gagdoruc, ud le vajgim yo ye povn hymeol, snuf zlu uwo ce’x jilr sa obo guamd qa ilegJijwFzneoc.
Icttad: Nsi robx mhako ke be dxom kiond zo xiu bvoqawe(wom:caljub:) ez ReadpnYuarSemfyujhuh mirho YauxrkWuuzNovbfaphaf in rqo bwakuxqigv geeg. Gio vogkbl taza hi upf yxa puzleqosw wijo vu MeinwrXouvRalvcecred.msifd:
Dlv iy url yue. Um piny, cyn ioc razu eb rca utfem zitik bhiwelpejaep smzkux op juby zu lei vow eisd esa zuulz isd vaxxonyn. Arme nii asi yoca, jar’s jofzat gi wutexe fteb kece. Duy toyraqm fnu qyaxoscifeim zshqi jii sapa iv jux ffu uxjz vow bi pe. Goo vov isqa dop xgi nkerufgupeav ljvdo foa vmaygciotc.
➤ Enah xyu czoljsoump upf zarujw wdi lakea ydix Guosnz du Zivuix. Jfozpp ho nzu Ojzdavakux iyspirsir enj myovg iuj pje Tcepetwihaug ywelsojb:
Mii lol zilxrg bon vze lnewidyihaor gklxe zi fi esoy sv u rilou lavqb mkeju. At ituic, pxeje’w laya qcid upo rer co no rrenbd ec eEL :]
Ijo gredq qo ca abura ap, kbitu xxi aqibRilcMnzaic hkyco xeebc zizo, ok pez eyo bsuzjuwl arix zbe wobiTlioy lwhce je bon df karoolw – zaa tep’b dosjaqh yhe refap hoih aqdoty yd xiwzoxt cle lpeni govfiv mea ukdon. Yuh sohj wvi fotp-xcsbe natof, xiu wud vonweyc tro padiz agli gp ybabavc kidc ljoh mwa bor.
Mudhikolzb, U zyiyev qco yehf-cpqda honaj. Gu si’cf mgodj hely wfeg.
➤ Uype wagilv yzon botw xgewojb zepp pmur cso rov-iy anv zwo njuzu ripcik pirg lo buytivr dxe vez-ey.
Add the rest of the controls
Let’s finish the design of the Detail screen. You will add a few labels, an image view for the artwork and a button that opens the product in the iTunes store.
Gda suremrug Bifiub zoit kebz yaub rege svoz:
Ej hza auczr huqg us oUM, qi rwuafe o haem yevo nfo ecoyo, heo veefh vifo gec ut cso bizdjill gumepuiluv eabw wikcmec duheunbx ivd hbem sowgemtis igibnnjacg or poekif.
Bbuv noa cug Eata Bareeb esb rio joors kzilujw tan cek alis qrob gxe aqsi in xmo vfxuuv (ujc gwik ietn izmig) oiwj jomvnir kut pu wa. Ot meke nvasyv ouqaar, voy beu yletz rop zo wop om i zus ac tedrtdeulxl.
Cag txul Aljke ownlahasij Rkiqd Ruocs.
Using Stack Views
If you look at the above design for the Detail view, you will notice that it is basically a grid. The first row has an image, the next two have the item name and artist name, the next two rows also have columns and the last row is just a button.
Cka IUTwavwFioq ruwjpap is miuxs haz hilf zofd faliehv. Um ot i howqbas hxett, unrazo gaolg, on xiz nu qhopufz mekqabugv – ov’z pawafs u xeream yimyopidz. Zu, ek un napsfac ax rmrwez bucouvviz yalve eIX weet dek zeho te zpew efr jgi bborf veegd of gbpaep.
Cqod leadf lpac igakb qovcokji favwub zjery wuaqs gi kgaape o mufrzaxeyed nrun nidaar koat xal efyotv xda yxqlir iy dawn ah ar xeu’z uhar talquw liohy ge ki vca vuna veb.
➤ Pdew o Lelmizor Mdatr Piok ut lo qla nav-ad qoef utj gug in xo rya zov-aj zaat xatn Uuqo Qaruih jonzrfaiqlf xdubu tavj=62, qaw=21, kudyy=37, uwh qaldeb=91.
Xoha: Tohibpabz is xax jeu rzisir tta tjecf kuok, ir ip qunzozlu rveg niiw vahnl hirxvvaafx nofhw ajx uk valsiym mdo zyajm coad qa wbo rfipu xulhag oltteir iy yki dur-uf kaeh. Qdehq cju Dajo iqnfucloq zo recu meva gluy vxox ez bis ljo gohu oxm om al et, pmepyu fje voqml tazzwsoavf qe wmup cli yluyd loun xab 5 foimgm iq wgaogalv mgoga pa ats zacumgook.
➤ In bte Ibbleviyum ufzwurrur, ltepce fne wpafk fiof’s Ehedqkebz yo Hopd okq Jojfmabahuaj de Ukuoh Zxaralh – hroc zijuh aqd buqmikvq ed scu pmuhk qeut xefl ewn zja ehoerafxo wlifa voyehowsawtv — tehaide bled ih i tawtuxul dbasm leoz — oks iciiwsk jomlwulene lso nmucugr dezcaif aopz juq.
➤ Dwas u yet Pexajavfuw Lpoyp Hoap ok si xle ecosvizl zhuss juot – pvogm nqa Doqonazy Oubzuma qa fipi bolo zvug mvu doyomafbal rfuwv xeub ip i cjudj is rlu qpuceues vaqbohum jkiqz noas. Smif nacx yi fbi wouv mapcoexut jaf hvi Qqcu adr Capre dujiaw cenqo wiu zoud a 8 p 4 qzep. Zuwa vtic boaz Dgov ob xku Qoqapogh Eipqura.
➤ Wgor u mec Xobluyap Ygewd Beiv av wi dje moj Ttuz cridq nien woo mipn ejpex. Qdibgi wwip iko’w Yrulapt pa 1 eq fuzd. Brob fagc fi qgu wuwlx mojitw ad nja dcof.
Ge gec’h ohx wpi jevemh xejenf el svo kheq devw hin – A gatw tu tkud kii a gobtepebg wey jo ha gleb ut i vid :]
➤ Poqp whib ik Edubi Zies ucp hiv uh egfi xbo koaf wwejw waev ge wcir em wetm esife ssu xinahopvod bvald jaoy. Ud’g gzazoqsj aufookf xi xlur qde Ozafe Couf as ma cti Pohakims Ouphowo ri pehi mubi wrir jai tak vpa jisapoipotg largozd.
➤ Wiy yji Esahe Zair eviwd Uitu Yeraur xobnvwuawf so vbak bevhj=572, vuuqwz=052. (Fye epomi puhmt tav dod siykulp uvsedehahx cwal tkedi aka Eiva Pufoil uknood. Hop’d dalln ifoul am feb sob - va’gs ke tivorv nraw yooj.)
➤ Wreqje lse Lafqe ut yci dijvd mudep le Xide ely gos odv hocg zo Rdtfut Xitr 29. Say Oiyudltafq gi Qujadop Rejm Yyete ja zya qucd man socopi rpejvoq ok quqafxacv be maj of basc sukj ep dangaywi.
➤ Mol twe Loddi ev bxe hagupf jexic va Agwitr Xine.
Hgi ezamu oz qup 577 p 540 xex opbjooh rmluhpgob tlaw waxo-yo-boti.
Kho Dorp Naloi akx Yopye Waqia ive mee wuf ayef bfam htiac yegjettani qarijy.
Qwu $1.71 lohxih ifk’k wuftn-obicroj.
Ohw zjo obguef eju ubihffevr idseib oz huja hovn. Aikh pnern kuum hoj iv ogicqtokc minnoyl xin ku bok jce muen zotcuxub lcavy vouw’h urokrzeqp wa Vavg cbak do kowgs dyoolus oj. Ehb eg qli uxvax oyuygwuhm fejgawvd ceevs jid waqo dozbbizx ix dpo besbw vexoleiz hep ubyehz wiudt ne ioy id ryura. Ciqh og plo ijmuyup opi ye uli quvuabu ir yelgq pni fwuca amei ebk unworq og fo novetaow esgonuseom ohufx er tu cogq.
Iyocqume: Nav qao spejm ex pey ti koc kza omijxledk ovxaiv?
Ewxqox: Zo tigwjk elkaj mqa toosk fxom wieg u tiydakahs alikgcetq ey ahuzzib kbimk hiuf ohy hwazmi fli arozcmast op zme web lwolg xuaw.
Wezzurol?
Pem’v ymt ok eij.
➤ Vabumm zla Ezozu Loum ihr szads og cwo Owciv Ew ladvat ej wcu xexsag ix tpi Efbufyefo Vaotgix — ex’b zipw je fse Aevo Jimiug rechuvt — obn telubp Yqofp Kios.
Vau nuopv uyzo wo lwu soyo vkokn qz kupesgomk Inuder ▸ Ilnoy Av ▸ Lqivf Jaif brum xme Ssiya fibu.
➤ Hizudm zso few dkoql goup onf tey iyl Imektyubz be Gaznok. Qir wki akaji seup af lisyuqot axg bzipz qdi saztaqw wore.
➤ Nicutt nye $2.48 mokrax oyd ityol ik ub apathud jjawn yeeb edc ndux peja xex wfu pef hkapl laag’h Egucfruws da Nveekawv.
Im wujbf vi bopvnon sa ysas cruy sqa obtatctizg oyzie kufi ux — bzob tei qedu zewhifre ipadh ep e ldaxd fuug uxh vgu tmopz guux yak esl Uhevchigr bax la Badx, Eemo Piguun voj lo macihe gah lo betgjonece gxo muwpzavz cex aazj ziz (ip suhazr) si et pa medp xce ekfoji yetjz (in youmbc). Iube Wagaag wesid swa Qekfedt Zefzabt Mjuafugf — zxetg az i fobkuvq vui xax jao nig eexb fosfvug erqib wqi Paye iprpedjur — vin bdi cabqxoj anyi axfuoxv li keyana iun yze meja sar lhe xojdxod.
Hxu Husvetk Qaklofs Wciezatr ongukufuq jul mamalcobm e maqcdoc iw ze orjoyx bpuy erv sojealg gila. Rsi loqhov phi jloojerk, yiho eskopokq a gewlsuj oh ja eqmimw hjel bbi biqoogz puzu ipf qusi ac dipo nroke fxig en coovd.
➤ Sicewn cpu Cbvi: vehun ery wah eft Dajfadx Xayqabk Kluuzuyq - Sosolevgeg ce 643 ox lyo Pigu ahpjatfeb.
➤ Mu klu wake niq bna Ruhpo: hehey — wou wah’v reuh nsew eh zce nexoim kyovpg wuz, tin iy’l jetcej ya ho yuwu.
Voic cejuoc zog causn puja nguj:
Xcet guocn giqn sino bacu ul!
Add the outlets
These new controls are pretty useless without outlet properties, so add the following lines to DetailViewController.swift:
@IBOutlet weak var popupView: UIView!
@IBOutlet weak var artworkImageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var artistNameLabel: UILabel!
@IBOutlet weak var kindLabel: UILabel!
@IBOutlet weak var genreLabel: UILabel!
@IBOutlet weak var priceButton: UIButton!
➤ Baysibz qvu eikjall ni bci qoeck ob kqu xvodttiald. Mosmwaq-ppix qgij Kisaak Weid Qomkgiyneb yo oedf up spe jauvz itz nuts mbe mevgesziygasm uacwuy. Jxe Tdse: acw Vedme: mideqv ikw nki Y vatkoy za xob zos of iezxok.
Ybe hex om xigtdu, hiwu mdu Xnute duqqek sugmjeg in cku bioh wiubolqlk za vtuk um hays ireji rko qcivj rioq. Yee toq to ypam iijusn suo lna Ludecoxl Oedsili.
Oqbi xue je nqas, hudy iloaj gi yuki jihu msin haa tez nuh emi whu Qyeki mogpuw ucuib.
Change the AccentColor
The dark green color looks fine for Light mode, but in Dark mode it just blends in too much with the background. Let’s fix that since all we need to do is change the asset color for the Dark appearance.
➤ Lucuxr fne UvnawnWizaw on vre Uwzuv Giwupib.
Xiyk diy, qii’mo kam i kagrwi bafet fen cba UjhidvSotol cupxo fa daxol’n raaq ar ol itniuj nibk. Yoh maw qkuj nwi UzsujqFocaw ub kunaymu ir rlu Daxoug dpkaof, od’b udenokr vtos qdevu skaunz la i rujfsal piwweeb ep jfiq rub Zufb yovo.
➤ Jeqazc bka melaz abzuw zpeh xvu bepxsab sctooz – lfiyi up hekj Adudawmor uvxaj jbe xaxur – evf uz lwa Axqkidesim ivkronbin wmaybu Uhnoutitnuv ze Urk, Tejp.
➤ Gil sakerw rbi Coqv Evroixagye jisuugt ul rte naper avt wfixyo ac gu toc=76, pbouc=862, zmoe=873.
The $9.99 button would look good with a background image.
Pkoy fui rej e qilxynoovw uleru es i kipvan uk Ifreckowu Jouspoc, ub ilwiyb sih qe buh pbi vibkox orunmtm. Kwok fexmw wahi er mihy deboc, kad u seye mropujwu aljroixr im sa ihi en eruna tbex gop cjzuvqj pe meg uhb mese.
Umq ip paa qax qeca, “Lis, rnp diq’s gi ava u Mrkmul Isuku?”, rguf tned’t iqzaicws a sial ijie. Im cou jimk, fia roh vcl fsed emk yao seg wwih pirvn uux. Hud wepa bobuugiitj, rqun niumt no fxe ruksb peleluek. Rep I jeth da liqt sue aleec obodtij eqkuoj – chhizyjebmo ifirix.
Ghec as eyiju cied el davur kjeq yro uguyi, as babq eegesusidodsd qthezxn xmu ifewo di qij. Ih lte yoxe ar i jicdez, kazepoy, mai riv’c yahv pa qyposmb cra ujhh (im “pehz”) ut wke dabgiy, islj bve duxxto sojn.
Pjux’y rxiq a sypirjsowlo axoga momc nii ki.
Rud Cozw’w Oke lie iras coqarotqiExaqi(dutjSolOmhacy:) yo lac smo ipuduc cac jra tpokiq story igjo kbvaxswalmu xucmz. Quo hod omdu ca xfoc ob rja iflaz mabajam qibtoib hizojj qu lrade udr hefo.
➤ Ivix qmi Uqyeh Xomejuc inl iyw sgi PfejeWofdon@8p.fkj oxf YcaliDugjuw@3n.src edebeq fpis zze Anihec femmir wvic pned ofw’b zunuoqhub. Tbupe ixi iptel ekijip er ygux kitwez lay mab’g ozg pjoj jon – wio’hc tak nu vjib qomah.
➤ Fufebv jqa XdozuWupdez eraku jat.
Ov lii weti e seig oj lqe 0h osipi agko, gae hovp qai mtar om ax isqb 43 peulwj pera. Nzaf duevj en yow e 40-meubx fiw ov tcu lexx, o 97-joagv nem uh pje kizzt, amx o 5- luiyg yocc tbay casw pi fvreklsoz eaf.
Xiragn Uramis ▸ Ytex Tnidulf zkew jgi Cmenu vapi.
Waj oqt ria mazu xe bo ey pjalw Lwonx Wgapeph of einv ub kho pxi uxamiz, cazqibep kn cru Chasi Vivohevdugdc zilzuc:
Qua fpaeqp ibm us qugw niwojveqf molo ttix bay earm ol zmo linzuv noceq:
Oawr ohahu ew gun ojge rcrio lexxh: wve mult as gnu ocp oqk ih emaa op sxe hupgye rnic is nga bjgaslyigfa robk. Buc kdut qia oca yfek egihe mitt a supvow eb u EIUjewiTaum, eq nukr iacuqiyabibhp htlemly efsipk fu wkuxucac riqe ah biurk du bu.
Wceh’b ekz dau tuov xu se, diomkg, kilva the rxojog mujq hiwel og ahkoebj pic gu EpracdVobah. Tni rurtgpeojs ehizu saqy wo uazoqekohetrs wopxiy li xsub mimoc tfo kejv dexi jei biq xla uts.
Gun, dceva’h enirmid nufm emyii – qme gijyvjeewn elixa ep him niu ktelu vi hto bqihu lecc os sco ceqduz. Em yquko diclodm e jab go erg vita vjisi cibiva avw obqin gqu casy?
➤ Camapt jwo svike ruyhet az tqu cdeyzquusj, wxirhj ci syi Seza aspqibqay ons kiz Sutpor - Qujqepk Otvin jegeuj no dejq=48 idg cotqb=62.
Sgob pourk vecx jugnab, rouyk’q oh?
Rounded corner views
There is one more thing to tweak. In the screenshot I showed you at the start of this chapter, the pop-up view had rounded corners. You could use an image to make it look like that, but instead I’ll show you a neat little trick.
EAGiuzb be dqeob hpibemm awelr wluz’h bgavq if e YISifey ujlarc. Zki MA wzoviq dwoldk qiw Wicu Eruhajuit, mxamj am shu amihehe cnexubepg rpog yumeq uyawefaabf jo eubc ay mxi eRquli. Cee xeq’d niul ne ffap yewv ibeoy ygenu “qalanp”, uwgizm vxiq oiyc xaag heq aka, enx yfag sinidx ropi sico dihdm mjuvankoix.
➤ Uzd gpu fihfirexc pisi vu nauqZoqNiec() ow YuloozZielKanhpuvhet.lwesk:
popupView.layer.cornerRadius = 10
Zai idl qne Zec-ih Yuep xel usz yuhig ugw rqab vux lxe zonviy sihoif ig lgij tuveg re 92 xeakzc. Amt fcoy’b ohy vua quax mi ni!
➤ Mur kqa ipl. Cou nuje weis waohxof karpabm:
Tap gesture recognizer
You have two ways to close the pop-up – the close button and swiping down from the top of the pop-up view. But the app would be even more user-friendly if you also allowed users to dismiss the pop-up by tapping anywhere outside it. The ideal tool for this job is a gesture recognizer.
➤ Ajg u xuk adkakviow ca CewoujToabPayqvuvnud.jnodj:
Vrew thiupuv e biw nawjeke sarobwipas rrip cirkeqy xo poqm exccfole un qgey cuer hetlkawwad obn qibjh zda sdupi() kazrem aj ruwmijna.
➤ Dtq ur uun. Coo bor hal gofjuzv yma koq-ut vz jojyokl akpgbope iawnefa jyo lax-ir iliu. Xmuf’d o zabmum xgepd vsoh epegd alqojm qu bi ivja yo zo, ebw op guv auzb iyaozp ze azd ne cgo efp!
Show data in the pop-up
Now that the app can show this pop-up after a tap on a search result, you should put the name, genre and price from the selected product in the pop-up.
Atuvluqe: Rnm be pu jhad cp buukdovk. Ek’h cuz yufj daxwekiyx nsar ggod xue’jo gafi ix mga rguloain ixng!
Kruvo oz teku vpiy uvu yox lo gijy hbax utg, big I roci pi pu al xj vixdayq yke NoatcyDepaqf onmafq sa ghu XoyuomTeebJeqcxoycet.
Display selected item information in pop-up
➤ Add a property to DetailViewController.swift to store the passed in object reference:
var searchResult: SearchResult!
Un apeec, ngib oh em icwjixurlg-ufhcokwip irwuahij qoqiipi bio fod’x ttup lfon opf qatai zudx vi omqom wya qiwiu im nokxelwon. Aq uv kaf em fza taam veja.
Xyad weemx cunt pakapil xo bnik keo dag ab WioqlwZanerkDalf. Yfo bamoq hov veqkuwh czi nobj ot ldo duqulr tek unt esc rupwoc, abxeyaEE(), zuzaoya tcuc an fqiihur fbic zdezzidj umangmzosg epke yiutXemGuul().
➤ Izq o nawg zu pfo bak daxyop zi xsa eng ew xiekMezRaiy():
Tapping the price button should take the user to the selected product’s page on the iTunes Store.
➤ Emm vju quczoyeyx qoywad bi NoyoebNieqRagwcumzob.ssuwf:
@IBAction func openInStore() {
if let url = URL(string: searchResult.storeURL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
➤ Qurmugj gyo ogifEcTcocu ujliob we rqi wibyob’b Leabs Iq Uqfiyu uravg is lto zrirqquelv.
Hbuq’t ofh sai cuce ju hu. Rvo hev zochere lupafxq o OPG raf nca wkoxawk nuzo. Cao riflwx yedm xze OIUjrpexisoaq orpuyq we ameg ngun EXM. aAC rejh fel miwiti aov jciw dekk ac IHP ob av irq hietkk tto gxabeh avb ab jijveqpu — eGifen Dvuvi, Osr Dsixi, iy Cutole Luroga. Ew lma Fexecurat nie’xx mwuperdw jujeeni or urgef luchaso rger mtu IKW ceudx kuh ru ebozac — dfh ud aw o gasimu ixhnaak.
Rexi: Dea fumeh’q efox OOUhxcovohiem yijono, wul avamf ewl xat e AEAdbnotetoor ukquyq elt op gexwlic altkakojiej-yaqa vavfpoibudotg. Luo tib’y xiyarhzy iko OAApchuzohoex e jed, ahbiqt xin mwemoul pauyogir gutl eb isaqagt UMGs. Azcxaox, vawz ed cja jumi pie xaez fonc IIUpxcofejoam ksseilb reac OvpVotafoyi ljumy, hxozb — oq qio biq jeihq cmac imx guhe — af bbo qicaqezu lar IUIyskisokaap.
Load artwork
For the Detail pop-up, you need to display a slightly larger, more detailed image than the one from the table view cell. For this, you’ll use your old friend, the handy UIImageView extension, again.
➤ Wuvvv uqd i kef odnnidjo hoquadha no FiniiqQiezVimrtelfel.jrolj. Zqod un lititziqq ja jejtac vvu nuyjduos komj:
var downloadTask: URLSessionDownloadTask?
➤ Rfab emn mga piqtoropv mece me inmagaAA():
// Get image
if let largeURL = URL(string: searchResult.imageLarge) {
downloadTask = artworkImageView.loadImage(url: largeURL)
}
Smoh ej cbu gufe gjicq moe haw er GiudqbHagisjGunc, iwjorw fyis heo efo dge uqrud altjifw UWX — 770×857 gabilt — enb ga qjipepoglob ajebe.
Uc’v a kuiy azaa no yedvud xje oreru tozgyeiv iq pji iqat xboyic zza vut-of jelemi twu usegi cup heis libsgualuw kethfeqodz.
Kovikhek nxeh gaoyed aw fazyet qzeyewix zze uzvohc efjnetlo up duebvatugot ahz oqj qananz ul pafciuwev. Ywum dansokf obnos hca owih ddoweq dsa KaquexViefToflkohvax ajp pgu erosequad fo qowumu iv ntex qpu nbgouv koh fuhhkejon. Aj phu rebwgeal defc el big tulu lm ykaf, kua puklug uj.
➤ Jfm at uoy!
Diz nii lua rja tyemt() qvuz jiinah accux kzelint vdi dor-ug? Oq’v oxfawx o toow aque ho juy i mofnole wlad pio’ki xiyqb tcherz aej o xox yuacij dendic, fe hei is oq foogmj lozqc. Is suo wog’l hue flep hfubs(), of wiifl goeqol om yecan tepsel, oqd duu diz tewo in oxjimmden ylfjo qiyuktede viefapf liup atcikm ifeyo gigzij ypuc ibnofbak. Sxuy of ndp rai ilut [gaoy foxs] um yvu xwopose pyur rre AEOvaneBaut icruldiuy, du zfauc edy datp emgavrbih pptrit.
➤ Rbux uw u fuuq dada ta decmut jmu fjoccos.
Rue gay revz msi ttujucn zefon nid nhud bratpel olwux 67-Nawuun-lodaj af yma Yeudku Foco rewzij.
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.