Ukuphuhlisa kwi-iPhone (4): isicelo sethu sokuqala (II)

Kwiposti yethu yangaphambili sibonisile ukuba sizakubanjani isicelo sethu seWoloWorld kunye namanyathelo esiza kuwathatha ukwakha isicelo sethu, ukongeza ekunikezeleni amakhonkco kumaxwebhu afunekayo. Kule nqaku siqala ngokuvula i-XCode kwaye siqale ukuphuhlisa.

Inyathelo 1. Yenza iProjekthi.

Ngesi sizathu, sivula iXCode kwaye sivale (ukuba iyaphuma), ifestile yokwamkela isicelo. Ngaphambi kokudala iprojekthi yethu, sinokungena kwi-XCode. Ngokubanzi -> Ubeko khetha 'Zonke-In-Inye', ubuncinci ukuba ufuna ukukwazi ukuthelekisa oko ukubonayo kwizikrini zakho kunye nemifanekiso oza kuyibona.

Okwangoku senza iprojekthi: Ifayile -> Iprojekthi eNtsha, kwaye sikhetha ukuJonga ngokusekwe:

Njengoko sibonisile kwinqaku elidlulileyo, kwiprojekthi ejongiweyo esekwe kwiXCode yenza umbono odityaniswe nodidi loMlawuli (khumbula ukuba besithetha ngomzekelo weMVC). Fowunela iprojekthi HelloWorld kwaye uyigcine kwifolda oyifunayo. Uya kubona into efana nale:

Siyabona ukuba sineefayile ezininzi:

  • MoloWorldViewController.h kunye noWoloWorldViewController.m. Zombini zihambelana nomlawuli wescreen sethu. Nantsi into eya kuba nengqondo enxulumene nembono yethu; Kwimeko yethu, nantsi kufuneka ikhowudi eyenza ixabiso lotshintsho lwelebheli kunye noko kufakwe kwibhokisi yokubhaliweyo. Siyabona ukuba kukho ifayile ye .h kunye nenye .m. Eyokuqala yintloko, kwiJava iya kuba sisiXhobo. Nazi izibhengezo eziguquguqukayo, iindlela, njl. Ifayile .m yile esele iqulethe ukuphunyezwa.
  • HelloWorldViewController.xib. ib = Umakhi woJongano. Le fayile ngumbono wethu, isikrini. Ifakiwe yiMainWindow.xib, eyona ndawo iphambili yeembono esingazukuyichukumisa.
  • MoloWorldAppDelegate (.h kunye .m). Asizukubatshintsha, inesikhombisi kuMlawuli wethu wokujonga.
  • Ulwazi.plist. YiXML enolwazi malunga nesicelo sethu. Apha sinokwenza umzekelo ubonise ukuba yeyiphi icon yesicelo sethu.

Inyathelo 2. Yila ujongano.

Siza kuqala "ukuzoba" isikrini sesicelo sethu. Ukwenza oku, kwiXCode sicofa kabini kwiWoloWorldViewController.xib, kwaye siya kubona ukuba isicelo soKwakha isiNxibelelanisi siyavula. Okokuqala, njengengcebiso esebenzayo ndiyacebisa ukuba uhlala ujonga ukuba uneMhloli kunye neeleta zethala leencwadi ezivulekileyo. Ungazivula kwimenyu yezixhobo zoMakhi woJongano. Iphalethi yeThala leencwadi liya kukuvumela ukongeza ulawulo olwahlukileyo kwimbono yakho, kwaye iphalethi yoMhloli ikuvumela ukuba ubone iipropathi zento nganye kwaye uzilungise.

Asizukuzama ukwenza isicelo esihle, kodwa sisebenze. Qala ngokufumana isikrini, esibhalwe ngombono. Ukuba ayivuli, ivulwa ngokuchofoza kabini ukujonga kwisikrini esilandelayo:

Kwimbono, tsala kwithala leelayibrari i-TextField apha ngasentla, ilebhile engezantsi kwaye ekugqibeleni ibe liQhosha eliQhelekileyo lokuLungisa. Sijonge kuyo, ukuba sinolawulo olunjenge-TextField ekhethiweyo, singasusa ubungakanani kolu lawulo, silususe kwakhona kwiscreen ... nakwiphalethi yoMhloli sinokuba neepropathi zayo. Ukukhetha iqhosha sinokubeka iTayitile ngexabiso «Guqula!». Ekugqibeleni siya kuba nento enje:

Ngale nto sichaze ujongano lwesicelo sethu. Iyahambelana noko besikucwangcisile: ibhokisi yokubhaliweyo (apha, i-TextField) apho siza kungenisa khona ulwazi. Ileyibhile (isicatshulwa esisigxina) kunye neqhosha. Xa sicinezela iqhosha, ilebhile iya kubonisa oko sikubhalileyo kwi-TextField. Ukwenza oku kuyakufuneka senze izinto ezibhekisa kwilebheli kunye ne-TextField kwi-ViewController yethu kwaye kuya kufuneka sibonise uMakhi we-Interface ubudlelwane phakathi kwelebheli kunye ne-TextField ngezi zinto zixabisekileyo. Kuya kufuneka kwakhona senze indlela kwi-ViewController ejongene nokuhlaziya ixabiso lelebheli kunye noko sikufakileyo kwi-TextField, kwaye unxibelelanise iqhosha kuloo ndlela kuMakhi we-interface. Konke oko kuya kuba ngamanqanaba 3, 4 kunye no-5 kwisikripthi sokuqala, kwaye siya kuchazwa kwisithuba esilandelayo.

Ewe kunjalo, ngaphambi kokugqiba ndiyacebisa ukuba ujonge okubonakala kwiphalethi yeThala lencwadi xa ukhethe, umzekelo, i-TextField ukuyongeza kumbono:

Uyabona ukuba iyacacisa into eyenziwayo kukulawulwa kwe-TextField, kodwa ikwatsho "i-UITextField" ngaphantsi. Oku kubalulekile, kuba iyasixelela ukuba loluphi udidi kwisakhelo seCocoa UIKit oluhambelana nolu lawulo. Oku kusinika uthsuphe: ukuze wenze umahluko ophatha olu lawulo kwi-ViewController, kuyakufuneka ukuba ibe luhlobo lwe-UITextField.


Umxholo wenqaku uyabambelela kwimigaqo yethu imigaqo yokuziphatha yokuhlela. Ukuxela impazamo cofa apha.

Izimvo ezi-7, shiya ezakho

Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel Ángel Gatón
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.

  1.   yenzef50 sitsho

    Yiba nesibindi, usebenza nzima! Ijongeka intle kakhulu 🙂

    Ukubulisa

  2.   phinda uqalise sitsho

    Ngaba ukhona umntu owake wazama (kwaye waphumelela) ukufaka iLeopard phantsi kwe-vmware ukulandela le mfundo?

    Okanye nonke ninemac ekhaya?

    Enkosi.

  3.   I-TechnopodMan sitsho

    Ngapha kweMac ...

    Qhubeka nomsebenzi olungileyo, sele ndifumana i-bug ukuba iqale ukwenza izinto ...

    Ulwazi oluninzi ngesiNgesi, kodwa akukho nto ibhetele kunolwimi lwethu lweenkobe 😉

    Enkosi kwaye Malunga,

  4.   UJavier Echeverría Usúa sitsho

    @resaka: kwimeko yam ndisebenzisa iMac, ndicela uxolo andinakukunceda ...

  5.   Sakery sitsho

    Ixesha elininzi lichithwe ukuzama ukwenza into ebonakalayo isebenze kakuhle, ndiyakuxelela kumava. Eyona nto ilungileyo kukufumana i-G4 kwi-ebay, faka i-Leopard, i-SDK, uhlengahlengiso ukuze isebenze phantsi kweprosesa engeyiyo ye-Intel (ukuba awazi, i-sdk isebenza kuphela kwi-Mac-Intel 😉) kwaye … Iziphumo eziqinisekisiweyo. 🙂

  6.   phinda uqalise sitsho

    UTechnopodMan, uJavier noSakery enkosi kakhulu ngokuphendula. Ndiza kuhlala ndizama ufakelo olubonakalayo.

    Ngapha koko ndiza kujonga ukhetho olutya ngalo iSakery, kuba ujonga amaxabiso e-G4 kubonakala ngathi awaphakamanga kakhulu (phakathi kwe-100 kunye ne-300).

    Enkosi kuwe.

  7.   vula sitsho

    Zama ukukhangela kwi-intanethi i-hackintosh. (EJ IATKOS)
    Isetyenziselwa ukufaka iMAC OS kwiPC.
    Ukubulisa