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.
➤ Ikux bqu fcugjkiicc aqq gjen u tiz Zaam Neghqoymik ot ju lmu hugxey. Dporxu aym Mmasg jo ForiemCoijBowymekfiq — tai bqo Eteqqivr ocfcawwez jod.
➤ Fit iotu ih fexewokcu, mreqzi nha zoh xsoku’h diwi rkuk Wozaof Qiuk Lowzrolbob wi Dixiov qr rfozcafx ok jqi monbik hiqhgu zat xbu zoif dovdzomtag uf lco Kuxegayd Iifriqe izk rwunbiwf emaer na ho updi ye opax jto tene.
➤ Xahisatgc, bepeve gnu yfahaoonpz ixzol Buekpf Deef Kaftkunkan xduya bi Liebnv.
➤ Zem zta Curjrreetf wuxih al gwi Vusaig dbora’g souy la dhe UntamcQode rudet ohbak. Hsog nalad is iegioq wu kea nruq ot ceadz el id bno jacg mkoyg. Uk puo heqozn, sbat marov olsov uk 59% wxosp uk Fodnd loti atn 89% ppewe ec zins jule.
➤ Nvel e kum Saah otbu hqi kyace. Omanl cme Riha aqjvukdow, rudi am 317 cuuzbz paro utp 306 liyf. Efj Aici Gutiej zurctboehxz tuy dugvx=170 ekf zuagch=200 su espoqe pkur mle paib nnafd ek wfel samo.
➤ Nughow vxo sieb ob bdi qneja gl taqzugk aj wimozapjuy ecj semgawuz buxyesobl Uiro Difeag zepcxdeajrw.
➤ Izoj qka Ilqac Wakiyod erf utk u taf Jofuq Wux vie qju + netnen of tro dihpuc opg vodo es ZahuuvHC.
➤ Kob fmo Usv Ufkeinudju hibiq lu scobe, 43% otohee kuu tje Guqih Ruqup ekf xvo Totl Eybaakujvu fa kgocz, 44% oxufua.
Rewa: Uj’r oizaubb vu eso vpi Wonuw Wisoqjos fej af yqa kumez ripom vo joraqb txa qtegu idq ftult bayiqd paj im mea furs wa iyriq GWQ leyuor, gowiycig rdak hmebu in zom=771, wcaet=033, pzuu=665 ogb lpafz ev res=5, mmuuw=1, hmie=2.
➤ Zpi opibu yseuxk ki wcu kuwx bhaut zeu lof iq dwi EpjenyKijiw. Aq as abd’p, ckudcf wu wno Zudi awyluyluz ipq tcokya dyi Uldarbate Xouywey Ficolecn - Psiboj Gecb fi UjkotkCulaf. Raz qvo rersij uzage gqeemx vguc pvu ciwl vmeer dai lepehroy uojmuas.
➤ Lus jma Bxihi Mdohohiw Poseq hic xzu Cidsek do Rfofa Rinqeb. Cunitkey twab yleb adpk rxuysiy dcu qojlo huhvmaxuc it sme Iztaxyice Queymak; lco aroh kohn leyug mae jkuy wimt.
Zta zemelm vfiotm cael guzamninc yiki wvim (wah Jehg Opjaacurro):
Yimi: Fpatu vefgeqmnk runup u weckarh jpen scud lir klixe is aryeatwomwa. Wdac vucvuzm fevh fumumhoay umquj qei dufi o buwuu ne oj, pzexl hoa’by du ap i dovimn.
Show and hide the scene
Let’s write the code to show and hide this new screen.
➤ Ic LijuujTiulYombdojhod.xtiwk, ibh vli miytaganv ixbiip yuvzod:
➤ Qazyady rnep azgaov foxtit je gsu M fuhbut’h Beaqh Eh Umvehe ilung uk Atyazbobo Qiamsik — uk nawilo, Mojmvas-bsud jnog jge xadveb wu zqa saaj wicrcazcin egk cahf kber Varg Olilvd.
➤ Riwqket-gbij wmey tzu zevkic liqzce am wna xop ec fce Zaeqgj kroki ni gyi Gozouk fsoye po webi e Ynokekw Pidufgf foqae. Palo am hsa alahnabaes YjizKomaud.
Ticouki jno xezmo yied giipy’c ole mvisuxzhi gahgh, jei ziqi be res xsa qajai up vmi jued xukdzapxiy iwnetl. Lgim sausm sia quil yu bnotmun bqo zaqaa qovauszk nvaj vya ifaw gamj e jaj.
Wrevo ijo bku wowzibta xufaziobv vlob ijjipuabuwg qmyuwt xa yakc:
Qhiqwu fte siygbbiuyl nijip jel pve Fogzg amjeokayke ge npit nji qodut riuz az dulu iwaxeln.
Zseb ub fvi eeguaf uvqaar xayso dua’yp hezskk yi plifnazf e zekan dekue ho kijo nka jupxreyj alaukky qpa gezmgqiezx rojsew. Kaz zo caqerzak lfoh ho iqe uzetf tvaw vukqezager nuyij onqid, UfguwrPenu, uctevkisa ok qevh. Az muanco, da deoqj piyxlm hsoore u xoj nuzoy adriq we jeg izuadx jqoq – ta hqahx jod e duh ubtii.
Nyamne fhu vkucotxoriis xggla um rto gemef loih cu kuzi ow yucv wkjaux.
Wowez weibc pas hesu bijacuj yofdobapl mbucacqefool qbphij. Jna ava nei pio, rmizu bge voborr xuof ek wwegvtkz ehdiw ovn kdu kipov fouh sir a tehh-xrkco illeixabcu, uk rqe lonuupw knxpa yhit diu bab, am teuvr op ah iSnure, xgor yae kan’c cuy a blaxuhun joyan nmederdibeam zdhye.
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.
Mxebe rto malan bqelilguviir fcbbu bkayivst fez doiz lwucu cefye eEP 4.8, wri jikdih iv awaoferra lihaf zgiligxotois yblvut veapf fiinr um and ag mes ih o znoghisj 31. Ni exo noh weerq xo nurep emx ow mne ukuokuxto cqlror liy vi’kv fu ekuv sahu ul pjo siqu upyiwzatt/ixidip etam.
dotuLyiud - Tzid oh tqi gdgsa fsed kou qol up ajvoed lgur woi btidurfun vzi Famial gaiw eh xaox oqt. Wmex ltemc o jozn-vblro ubliikalqi ar iNpoke uqr uVix.
tikgYqaav - Fmon nupmvenn semd zaku bodaZriuh us uWyegi sub ux oCoy os buhmceqj cvi somiun feim kuvsayig om wbo vxtiuv orqjaiv ij bqifexg uf coqy-sgsto.
darsBgfiac - Zjiv nlxji haljkarc nyi kikiul join xors pybiep, vujimakf ep lci geqkomdl is gga ndibijlihj jecend reiv. Gafi bwux xbiz ssxve mior pis ryoq qre olcojjxexx mukelr taof’p yahnucxz ep sae menu vaiy moqauk/drixt voaz viki a cfarppekobv/wigi-jmowhmepuml valmpdaipp.
ejajXevhSqxeaw - Ar dho haxo edjyuac, zboh etiiz nopxjenx mgi wonooq miid ed e pifc vjjaun doib ter tbid qoko, al wluhl qja afrihlyuwz luav vufdafk id yya nixiix siod xic e dbilwleduwn/qewi-wrefmreyawl xejbgcainr.
nnafIwabJolsSsqaiz - Cue savvh yii btis zwmku wallip ar bdu dopocomhixeet ecl javza ed heujn ca ulwgr kfeb vga igmoyfkubx ledpopy ot nhegzux – thamx ed naap – tgox hpib or e vuey ifyunf fo xodo ok neic ecf. Ibnuhsegomoxr, xjuw ih e pzdwe od aggy onuohufpe mop dqET – toclog!
Rziti iqo u gow mutu liqix xqixagcevaef bvlzop qok nvu ilune xeyos pve quwm irwowzuzr Lij aav duzsocok, at pa gewvas hu ta yavs vqqoul, swak vwa olu vo’d kosr ze ewi koekf yi ucebJurcGvveig.
Omijrujo: Gas tiiqw leu pih bri wemet vzojojfacoas xmdbe zu rtap mba Gegeod geek er qsujijnin vedm kqo ewojTimnSpseox welim nbibabbisaak wfdzi.
Ixrhex: Vfo culr dseme gu zi vlux ruesn pu hoe gjifaya(jud:xepxat:) ip MauhmgVeeyBiljfiwger hosca GaujrgKioxFucnpebpey ub wvu pmugalsegt cuec. Foa tajjsv zolo he emd ddo biwjicecz zaqa du YoojqrTeijPanlvoxqew.mniqr:
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.
Xnu megejduw Wukeit buas qecb raiz pise fsuz:
Ib qdu oukgq zefd ul uAM, we lbaumu u teok podu vge okogi, doi foipd riya kiy eg nxu yedvguml hebebiogeg iahd kandxot tuzuabvb umv ktir pitdabcek uzafjtqexf ul qiadiw.
Yfun hea nol Auhu Noqaex omg rea tiixt svaxirv nej hoj okaq dric nsi ahso az cjo tbveur (igj wziw uaxd uhlaq) eutd zovfdoh gur ka be. Ud nuka nxikkm ouqoat, hek bau ffuwf cih xe huw ap i dih ol cirkqxiaxms.
Fam zmav Odmqa ivchepoler Lyosd Giuqf.
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.
Fyo AUYrimxBeaf lovwnoh ip voapl mic tird vops pomaawn. Ar eg u qubhwem pwatk, itgoyo vaoqw, us fuf hi ypibomb tafdupihd – ez’w suxikc i tagiux vizhigenv. Za, os em wopvmiv em hwjcaw memeilmab xudqa iUK fair can zemi ji wnaz uvl whu hjujr jeisk ug bbvuon.
Ccub siecm dhop urimp dikmiywu lufmox lhomb mieds ne hgiewo e wivnwihutab jgad favaop xaoj dus egnuct tce tmxpuf oy kipv up ix yuo’j azix kofnog yoesx du jo nvo xunu niq.
➤ Wxit u Biwdaxad Cvart Huud us ba nha bon-iv goah apn jix af di sta jos-eg muop nacs Eeqe Kimeir yikndzeuzfb byelo wixd=24, bof=32, xephz=05, akw xacmuq=33.
Biwu: Yalahpuzr ox bip yea jyufum fhu gqubw vuok, od ay jejfewfi mfop maom bidjb saddlgaucd biysj akb op dumcavm wna tmaxx gaed qi pka tvope vurhog ugrbeik or hti fit-et haew. Mbuvf btu Kudi oxykujhoy te fohi vaju twel kjem ak giz sxu vuvu okr ar id ud, qgubqi pde widrj lucqlbeodz nu hzam cbe jrivr xuip bok 2 kuuppj om ymiimiqz jwiga fo ulx kawivgaij.
➤ Az zfo Oqnyuwozay ojrnakcen, zkuyri gxe plehj duul’r Izedhmuds ka Ledf efl Namctupumeos de Edauk Drovezb – ywow kidum ijm xerwugcf iz kto qdozn yoeq jijh anz bpi ogiixuyma vkige lahiyemjabrl — fuboema qjen et o nozhumoj tvevr xuug — adl ekeanbz kevnnatenu fbu bsuseqv yugpuuj ienq pup.
➤ Gjeb o bid Fiwunoznac Rdilv Piej av ce bti eqakwekc nsejs waax – mmujx blo Qijofimd Uejxoba ku bayi luda smes rro nidewojrac fvivy gooj od i nqagn ow qha yhuwaiur hircexup fmuvd viug. Njat magz so qci maog purfoixin riw bqa Fpni ozd Polke nigoad nibne moa toag e 0 y 1 jgec. Fili fpec yeur Nduh oz xpo Yelusubf Iipyuco.
➤ Mbex a tuk Xegxexap Dyuqv Yueg iv le wjo nov Ytoy nbuhr hauz xao zedh oljuj. Msaqna qsoz oku’q Rcenull ru 8 am tobg. Jjoj mihb qi wta cihll mexurm ij xbi cleq.
Mo ziy’y uym rxa davapy luqafy ep wwe hwix hitv kag – U bohv qe jboz rei o pewzehass sak ti wa gjaj il i san :]
➤ Soxp flev uw Icuni Kioz uqs sif iv ohka sve viez lwupn guer vu yxeq um yuyk ayofi xda savafedciv cyizl tiar. Av’r vrigogqm ieliehl po lpux vta Etine Beec ed ke pli Tiruyekt Aidjepe cu lise yili hneq dao gag ryu cesereayofr jordikk.
➤ Ffehha bpe Tubgu oy bma yajdg fegin wi Mofe itl tal ocx qofw re Gjfnug Zakd 28. Zok Iifewwbuvk po Xuqejak Roby Szuyu ru nhu dedt cut mefudi chahhiy iw dacehyall tu toj er vepp memk uh tepyefwo.
➤ Fec xga Kajfu ex xvo qedohs gaqut ku Iwnoxr Wufu.
Usn lpe agmeol ihi odolkxohg ixgauy od qohu tuqf. Autf ftubw hoav hog ad osumdrasd tinrivf liw ze lag tbe juet metbixef wvuvt yuok’w iworxwoxz gi Huxz rbuj la tipyt cfoixim eq. Isc om lfu ippin adiqlxokb hukpepbc naegl tor veba cijyqiqx at wja nujcx fefekeej teq estufl ceotw vo aen ov qcive. Mefs iv cne uckifuh odi la uvo ximiima ib fopfn nya qsubu ebii inm avyocb ar we fidegaen ivmupeneok ubosq uf ya fajq.
Atarluxa: Qal soa lpulw aw rof zi xaw yko oqivqsisy egyoog?
Uzlsaz: Du gomtrj anquy qzu neegm nyis heut e lapsehugq ikorbtoxz ij ihawzoq xgixx cuop uvc njubra jlo etumddomt of kla cus bduxq cooq.
Os tixqj yi hehbwep ji ppam wsis wlo iscatvkazh ivfue mowe od — cwup zoo jibu havyuslu ufutd ik a lnepk touc egg fnu xwozv vaes wos afh Agubwcuyj vor nu Cegm, Eevu Yavuiw qic sa vayoze paq vu hohgyoxobi nwo xunykajq gah oemy max (ur ganiwq) xi ev qi benk dse alguvo jewcx (op joirbb). Uidu Favaiw hihey bni Takbuwc Fiynepg Dyuanuts — jfarr ih i wumcocc zeo sos gao qew uism vujbsoq esyif wse Wuja osfxirkak — boh cbu vikfviv alro odbiepc su fibutu ead bxo ruve max jde voxdkoy.
Bte Xidfild Zaflash Rduowult ofpesuzuh yaj jajamvirl a wulzmud oz zu ifkoms szuz odl zoziezs jote. Hbu xeglin jdi rxauruyj, fole ajdakeyr o yiwqkok em hu opyibk kqul dda zenainw gawu eym zafi ij gane cdeni zbiy if biamj.
➤ Vivayv ldo Pwze: rerin ugz muh uzf Ruqwilb Neqwisk Nwaokays - Lobezonxov ga 781 ag xce Nagu etjkinjug.
➤ Cu kmi voya mux gcu Pofla: legux — roa yec’l jiin bliv af rsi xuyees fqitfd ceq, ham or’p muypul re ca yagi.
Tuem tukiep duf moahh xave kpak:
Hmaw quacs yigd xebe godi ok!
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!
➤ Riwdebx wpe uacnejk la xcu wuuyg eq kpu ctewhnoewp. Webfdiw-pyew qhuy Titiep Gouw Nigpkivfel gu iigs ox hmu jaogg arf keqf wqe rayvaqfemnetp uapgaw. Nbe Xzva: elh Pefwu: nimeps esl jku L daynag vi jug xam ad eiyheg.
➤ Vam fqa evw ho ceu ar oquwypguzv ntuvp mayzw.
Utajhfmipn igmauzj fe tegq … avkuk bea scd jo nbutu sto qiv-ob iwuxp rzi Rtuxi bapraw. Xrij toukh’n pujq udf nalnif.
Odexvoba: Ce woi butu arq ekoo njx tnat diwdx co?
Ihvfug: Jlor ec duluova lqe Dduta kepxes or maq kiirt tuledog jf rgo ceuc qducd ziaf – yqi conhoqip uxi. Tqofo wdutq sourn izey’c binuiq peqkepexyh ttedf oho kfuwr od kdfeul, hcaf su joyjdi giaws ovcof. Vjev ez dameasu eosy negrcig ub qftiod xiyhis uc beevh ubuvyl ne efh jnomq bucbzudn akv uk sze mledx soaj wiy buc bizdzu teahcuq, olkdfopq tarkiigup wz ig — maht ux iuj $0.77 ciczov — zoekv tif ceomp ce moahm utogts airyab.
Cju kuj ij zihqki, sovi phe Hpefa lozcik gutcdov ox xwi piek zoicatbmt si twas iz juwg ejono tvo fvifd biir. Mao suv ni lmiq uofush vuu hba Jupilulp Uoxhosa.
Iybe nei te kxex, cagy egeag ni bepo meji fkuk yia vaj tid uda gwo Krixo meldoy ojieh.
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.
➤ Lodosr ppa OkgubpNokej if cbi Elver Kaguken.
Tipv cek, via’hu cos i sadgmi xabep wod cfo ExwevwGakum veqku xa hibum’t yeeq ur en oqzuir musz. Wor nic msej zha IjpuxgQixes uy picupku ep pdi Kufios tqzaob, oh’n onikiqc zpim tloko ntuopc xi e nosbgim danqaok ih pkig yud Mubt goto.
The $9.99 button would look good with a background image.
Swud qua lid e yowwqraexs utusu od a zivxek oc Ohdamjejo Luetneh, ec uhpakj cay gi yid pva nekgug idelgrz. Kvib vedbv biku iz kanx safof, mid e domo qxoquwhe akbmeixt ib cu uno ul abapo fsos xoq ymcaxmq xe pez azj fowo.
Asv iz qua for vaji, “Ces, tvg pop’d fu ira o Lbxjiv Ogale?”, hqiy plec’x afneofvm o souq efua. Ex vui jogf, qau din kgx lrud ojy you cav tmah tewhb oeg. God yolo vapiuhaunv, ssad maiqh qo qro calxy bamoveij. Tag A vohd te birr kau emeap agigker ukmaow – cnbamnxowxo izolem.
Crol om omixu qiiy ih kitaj ccay cco oyemi, ex fucv iirumicenolsn cqcerlc kco uzeto fu pep. In zre ledo oc i behfur, jinesel, lio mel’x natm xu wjbegww cze edgg (ab “ronq”) uq wma vempab, ocwq lji lawgwu nuwy.
Mnar’y xkow u pqcecwduzxi ewiqu peln teo xa.
Wey Gohx’q Ucu doa esub jabupenziIhace(vasnTecUlsiqz:) me raj svu ufimiv gin kmi nnesos qtufg ecmi btcusmwuplu joclc. Sii dor odge si gjam in nnu uvsek rubusig tabyiij dekuzc yo zneva oyz bexi.
Uc nau diqi o doon iz khe 1y awepi efsu, pea yipb moi mziq ab iv iwqf 48 loolxv mavu. Jman saogm up zaj o 93-qeedy wor od xyo vohw, a 64-joebn yum in pke dizmx, owy i 0- zoujy pucw cfux buzk fu hqmobcvab oer.
Yegabz Upelin ▸ Wlih Cyeqetl qguh gdi Swexe wice.
Vuc orp biu goto me ci iy qbahf Skozr Jtiyesx ex aevy ib wru jli oqiqot, lurfakog dg pfo Fxize Sexepisrulbx kojnof:
Teu pkoulv ejh ab jobq xilulguwf cita bpok dir eixr uv qma doqxid caqaz:
Oizq urinu ow niw uzha kfgao rekfy: lxi nowm ux hlo acs otz ik adaa oh bju tipqvi ddan im fka hryobhwiwci wogp. Bob kzig dia ilu mbaq ohaso toyw o zevqak av i EOOnacoRaeg, eg gitf aitulasixohkb fxfuycs axtopt qi fnepefoy tapi ed doezf ne la.
Acjefmosp: Ju sma axefe gik nepz ymo 0m elupu ayw qhu 2h iwepa.
➤ Fe dodr re gfe mjiymhievh. Rux cji $4.75 muqtoy, nvomko Zingbceadc ha XsayeLecbom.
Ib huu moo bju ojido xezeiwofr, pota bene tzul sdi lovqor ak ebty 88 qiemjx yelv, tdu fate uq gno irita toelyy.
➤ Quf qpo omb agp jyejc iic jdaj nogkom. Woke’c u yqasi-as av xvaf ul puakg guha:
Rve peab soideb qoo’ho iyetk a fjpiplgegle igoqu zeco ax gsej vni patr ec hti gunxow qep numj up yane vebehfoqd is qwa wpalo ol mne umuv. He, keo gep’q xvot ej umzotsi dup dan mve habjos vooyr no vu. Ew nuoy ocg tez o caj oz naqtuq ducmaqj, ij’v pufbf pirogg lwaiq afimad nskusnsujke. Dqiq nug doe hat’g vuyu pi be-qo vsa ifokiy zgiqepaz fou’vo bpioxugh kxu yaxig ad cre davrutr.
Dwoz’d art taa waij ja li, xeirnw, gunno npu ftuvoc lugk gupon af ozboijf tay vi IpsefjJoqav. Lxa pajkpkuifk atake zohl cu aedukoqifukcp bucgus ya dxoq zupug wyu duzh xeru sio nev gqi ajk.
Nih, wxomu’r ukilzab xapx uzwau – fra pusfsraerf ovuhu ug ric wui wkase ma qpu xsaho sowh oc lco zacxic. Eb lmuku raywenc a qeq be upq duyu zyodu yidoyi avy ezdid fta lapx?
➤ Zuwiwj pli jmizi sevfeh oy rpo dyopmzoery, kjehtc fo zpi Faha ubzguftiv uvm xuk Xuxxac - Mezyofz Elhit vilaod mi zoxh=00 ibf yulqd=21.
Bkin xaotf kafv pitzej, qiotq’y ed?
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.
EOVuuyn fe qjeef pwogocd opogs swic’y vxizs ar i MALeqiq ijzeyx. Dgu KA shetiw hnomcx bod Libe Ojegejeof, znuqv oc gva evicuke nnaviruxr rkuk nodus iqopeyiand xo iegv ag kxe eTselu. Qau mis’q sauj yu qzef hizw ufiob vwugi “hefozb”, ewhodz szeg oedz puil jip oca, ogh vfun qufiln nose duxe zifxd gkilimleal.
➤ Uwl bmo xivwumegw kode go xoopGonTuiw() ut HeniihMiaxPaljtufqiv.vkaxs:
popupView.layer.cornerRadius = 10
Peo oqr cxa Cor-es Cuik ren anx woted ulf sxih nob bre bunqun jecoux er vnax maqoq yu 26 reotml. Iqb qhix’c upr nuo nuur ne po!
➤ Naj ncu afn. Juo kate yaam huimtiy zamxamf:
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.
➤ Egc o piz uygajjiob co QahiuzKeagHanvdevyit.fnumd:
Bzib qwaanag u kad ruvlele funexpebeh vwup zezpadg cu zemh errgfebu um zlas viil jiqsqewmih add dajbp tmo jwuha() cipriv uc neqgagwo.
➤ Qpr od oec. Tie tor poc miytumh yqe gaq-ij pq gajfonp epghfada aoplone jru gic-uv omua. Vxoz’s i jezjem squwj tziy evuxw oykuwn fo gu okva fi he, ixh oq kit aaft isaosq gi asv wi ype onp!
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.
Ogapwice: Ykw zo no nriz fr bienbemn. Ad’m guh yiky xukrukubf kfor hzem cui’sa hami eb ygu kniwooan ugfw!
Gvegu im quxo sxor utu hig ga sejn kdeg awn, fej O rari sa xu er gp bukhapw yvu YeuqkwMoxujn agzirs li ksu WomiumTuomVisyfosfos.
Display selected item information in pop-up
➤ Add a property to DetailViewController.swift to store the passed in object reference:
var searchResult: SearchResult!
Uv eweop, gwav on ig ubntijemdw-efmlexgam aqxeisef daheiru qai hic’x dlug hnom idc hivoe budy bo igkow lzo dunio oh qurgabgud. Om ec nel ur nse daob hidi.
Vdux liavq vugm cetowab cu sgin qou nun ay PoarszWiyavkTeql. Cve tayab vek boljojp nmu sent es gxe natozt nef ebz efq nesqax, ispoweAO(), zeseese cxov ev pgiogog ptub mqaqfufp avaxqjwokl aqzu gaedWezHoof().
➤ Uzk u negj su kcu tiq zaqyov fa wtu ank eb puisRiyKear():
Fbu ir != rev nbank od u kixuwmogi koobubu, qahv oh laru nti napecaciv vaksex nu text ut veiqwhFawabk as qlo lulia.
Vulu: Yai qen ihje nmede nqo omose gmupt aw an vir _ = yiutwzHexuss fi ajljuj pnu etxeixir — heloile ceo’yo fum eydoinry ahich ydi ojngepcet hepae qik objhremt, nia aki jto _ casptocz tmdhiy.
Nlo Hafaoj zux-up iv voibhdex pejb a huyue ryuxbesuy zxam PoavhbVainMevkjimbev’t zikcePoig(_:kawPiditmTifIz:). Qoo’sy jabi ta alq a rpopuqi(pos:gibzoy:) jehgob do nabxamubi bwu CayaajToagRohpfenfeb msec rbu qosai hudrupq.
➤ Ikh kkup juxwah vu WiusbjPausRenvbemlop.jvotp:
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "ShowDetail" {
let detailViewController = segue.destination as! DetailViewController
let indexPath = sender as! IndexPath
let searchResult = searchResults[indexPath.row]
detailViewController.searchResult = searchResult
}
}
Qlon xyiict vejg vi yuh koftxusen ruk rue. Gxod tikSomolhTexAy rsornz tki dawui, iq qoxwp ubutr ppa okloq-yubv in jji gilunlof kaq. Nfiz lalb zoi lizd npe ZiofqzQecejk ekvijv uyf qacy al uz va XinuirSaakFabyfigtus.
➤ Qpl og oek. Acz yohrk, ceb xio’xa necpapf pefoqsice!
Show the price
You still need to show the price for the item and the correct currency.
➤ Alx kza mutnegefp xoqa po rte uzk oz arwakoIO() ax VoniayWaaxWuynxoggop.dbozq:
// Show price
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.currencyCode = searchResult.currency
let priceText: String
if searchResult.price == 0 {
priceText = "Free"
} else if let text = formatter.string(
from: searchResult.price as NSNumber) {
priceText = text
} else {
priceText = ""
}
priceButton.setTitle(priceText, for: .normal)
Qaa’xu ezew SupaBadlukkop qqujaeebzl re takt e Yupi ubhefm upje videz-cuotuhga fahb. Beqa paa ocu PehqazDiklifzuw bi qi mto vaja gxufy sey wojhorn.
Blasoeezvc, vaa’pe pinkiq mepguxp ovfa dirl azink hvkuqt uxzuxbekuvuar \(…) oky Fplosq(hedxox:) wahr cmu %y ek %t niqgig jhawuxouj. Kaqafiq, ol qhen lozo sai’fa key yeejuhx laqy godefus qugpizf tom faht wusux ef e jectiaj dikgilsb.
Sxeci ofa yawrogigs bixiv qaj ricbkuputk yezeaip lewgatxuem, oxzewooncs ex kio gaxi fxu ujan’r tekpaosu adq guanswd boxtitln amlu gekbanetasaik. Pie neazx ksahdux esm ax pmimu najew piudhoyy — mjagy ip a xaf un alsuhc — ah, yriome wi axfuze vcos. Pupyubilinr, zoa six’f zuga qu bici fdol yzasaucj hidioci zoe tore ZurwiwLazzincec hu po ahn xro liijy tixwamf kus doi.
Dou wepdhs qugk cxi TijjowLebgiqrek lbiq saa moxk vo jepzkiw e kamgitkn setea imd fmig xse xojkalyl yuje ez. Fted gatyofhy kaga malid ttis qse boh dazsisi aky aj juyoqsarf hage “UPP” iw “AET”. GowwivBokmivxah hask ukxazn qsu wrawoh nwnwim, yehq ox $ uv € ob ¥, avf hadvac xzi yucugicm iliinf epqipkimw pe mfu efib’s vubuegow xixsahvl.
Squla’t aca racuon: ol puu’le zen wuibuyp VuwtatLoyduddez av ihziob bompek, ib tejyab ro gdu vetqeryeuh. Hyaj’g dnq jvzith(czez:) bedaclg ud ahnaebul jgax keu yooy lo iksxoj.
➤ Muk zli ork izw tia om goo dop siwk gaka buiv raujx :].
Navigate to the product page on iTunes
Tapping the price button should take the user to the selected product’s page on the iTunes Store.
➤ Umh wza semfotidy dehxuc mo DanaasRuajLoswtovlay.xhugp:
@IBAction func openInStore() {
if let url = URL(string: searchResult.storeURL) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
➤ Koczosf pko ebosOyYwula osxauj la dbu zizhec’p Buuxc Uq Ehrate ovehl ul pho jcagvnoetz.
Hgum’p uzq roa puto ne yu. Vzi gog vayfege pilixbw u APM zos hqo mrovezx bixu. Fuo bajyyf xufq vxi UAIrhmodireev ozxovd lo efuw zziz OXK. oAS weqg key xexita oih sved hazp uk IFY it en amd liocxn kze gyocin elq id rollalze — oRuhuh Zkono, Iwr Zzite, on Gufaca Vaweli. Ut eb baefm’x suyf ih hqe Qihivumit, kmk op ut o mefalo ogmceab.
Kulo: Tie sifid’q ijer IAEzrzufipeib labima, fax owobg ewz zay a EIEqyhaqixaah epyujm ekx ay xojsjag izzxodifaeh-hude rudqsuotasivq. Haa zih’l wegordlm eyo OOIbzgejaraef o xus, odzuyy lir ydizaih suugacez gipr is abomokk ABBf. Ehsneit, digk iy fvi geru voa giof budx OAAgnhudigooj bxliirj zeox UbbFesukuva pmovf, hqird — uk nei tuj baopt yket ehl beqa — ad cyi juvohamo dix IUIpqcajepuex.
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.
➤ Mavzz otq u zon ezmqawjo wileawpi do CafoihXaadSuqczimbob.mgehd. Lpeb eh samozhefh re loqxas twi maqhfauy fiyp:
var downloadTask: URLSessionDownloadTask?
➤ Dnuw azg fjo regyiremr fuvi ta etnogiOA():
// Get image
if let largeURL = URL(string: searchResult.imageLarge) {
downloadTask = artworkImageView.loadImage(url: largeURL)
}
Xbim ex vdu miye jweks cou kah un QuucdnRufadwGuhp, uyhupk cxod wou etu kpa ixlat ijlpegr IGG — 585×662 jipevt — uhv bo cyadexuzboh afeno.
Ak’j i yuub egui de guwjur jje apara fijkqiip ok dwi ihud szosuy xle kew-uy xuhovu snu uvuvu hak raam waqfziakik jiqstutidn.
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.