Ke hoʻomohala ma iPhone (4): kā mākou noi mua (II)

I kā mākou pou i hala iho nei ua hōʻike mākou i ke ʻano o kā mākou noi HelloWorld a me nā ʻanuʻu e hele ai mākou e kūkulu i kā mākou noi, me ka hāʻawi ʻana i nā loulou i nā palapala i koi ʻia I kēia ʻatikala hoʻomaka mākou ma ka wehe ʻana i ka XCode a hoʻomaka mākou e hoʻomohala.

KaʻAnuʻu 1. Hana i ka papahana.

ʻO ia ke kumu e wehe ai mākou iā XCode a pani (inā puka ia), ka puka aloha hoʻokipa window. Ma mua o ka hoʻokumu ʻana i kā mākou papahana, hiki iā mākou ke komo i nā makemake XCode. Ma General -> Layout koho 'All-In-One', ma ka liʻiliʻi inā makemake ʻoe e hiki ke hoʻohālikelike i nā mea āu e ʻike ai ma kāu pākuhi me nā kiʻi āu e ʻike ai.

I kēia manawa hana mākou i ka papahana: File -> Pāhana Hou, a koho mākou i ka nānā ʻana i ka nānā:

E like me kā mākou i hōʻike ai i ka ʻatikala i hala, no kahi papahana XCode View-hoʻokumu hana ia i kahi ʻike i hoʻopili ʻia i kahi papa Controller (e hoʻomanaʻo e kamaʻilio ana mākou e pili ana i ke ʻano o ka MVC). Kāhea i ka papahana HelloWorld a mālama iā ia i ka waihona āu e makemake ai. E ʻike ʻoe i kahi mea like me kēia:

ʻIke mākou he nui nā faila a mākou:

  • HelloWorldViewController.h a me HelloWorldViewController.m. Pili nā mea ʻelua i ka mea hoʻoponopono o kā mākou pale. Eia ka noʻonoʻo e pili ana i kā mākou ʻike; I kā mākou hihia, eia paha ka pāʻālua e hoʻololi i ka waiwai o ka lepili me ka mea i hoʻokomo ʻia i ka pahu ʻōlelo. ʻIke mākou aia aia he .h faila a me kekahi .m. ʻO ka poʻo ke poʻo, ma Java ʻo ia ka Interface. Eia nā hoʻolaha o nā loli, nā hana, etc. ʻO ka faila .m ka mea i loaʻa i ka hoʻokō.
  • HelloWorldViewController.xib. ib = Mea Hana Honua. ʻO kēia faile kā mākou ʻike, ka pale. Kāhea ʻia e MainWindow.xib, ke alo nui o nā manaʻo ʻaʻole mākou e hoʻopā.
  • HelloWorldAppDelegate (.h a me .m). ʻAʻole mākou e hoʻololi iā lākou, aia kahi kuhikuhi i kā mākou ViewController.
  • ʻIke.plist. He XML me ka ʻike e pili ana i kā mākou noi. Maanei hiki iā mākou ke laʻana e hōʻike i ka hōʻailona o kā mākou noi.

KaʻAnuʻu 2. Hoʻolālā i ka interface.

E hoʻomaka ana mākou e "kaha kiʻi" i ka paku o kā mākou noi. E hana ai i kēia, ma XCode pālua kā mākou kaomi ma ka HelloWorldViewController.xib, a e ʻike mākou i ka wehe ʻana o ka noi Interface Builder. ʻO ka mea mua, ma ke ʻano he ʻōlelo aʻoaʻo aʻoaʻo aʻoaʻo paipai wau iā ʻoe e hōʻoia mau inā loaʻa i ka Luna Nānā a me nā waihona Palapala Waihona. Hiki iā ʻoe ke wehe iā lākou i ka papa kuhikuhi Mea Hana o Interface Builder. E ʻae ka waihona Palapala Waihona iā ʻoe e hoʻohui i nā kaohi like ʻole i kāu ʻike, a na ka Palekana Inspector e ʻae iā ʻoe e ʻike i nā waiwai o kēlā me kēia mea a hoʻololi iā lākou.

ʻAʻole mākou e hoʻāʻo e hana i kahi noi nani, akā e hana ia. Hoʻomaka ma ka huli ʻana i ka pale, i kahakaha ʻia ka Manaʻo. Inā ʻaʻole wehe ia, wehe ʻia e kaomi pālua ʻana i ka Nānā i kēia pale aʻe:

Ma ka ʻike, kauō mai ka waihona puke Waihona Palapala Kahua i luna, kahi Label ma lalo a ma hope o ka Pihi Kihi Kūʻai. Nānā mākou, inā mākou i koho i kahi kaohi e like me TextField, hiki iā mākou ke neʻe i ka nui o kēia kaohi, hoʻoneʻe iā ia ma ka pakuhi ... a i ka palette Inspector hiki iā mākou ke loaʻa i kāna mau waiwai. Ke koho nei i ke pihi hiki iā mākou ke kau i kahi poʻo me ka waiwai «Change!». I ka hopena e loaʻa iā mākou kahi mea e like me kēia:

Me kēia ua wehewehe mākou i ke kikowaena o kā mākou noi. Kūlike ia me ka mea a mākou i hoʻolālā ai: kahi pahu kikokiko (ma hope, TextField) kahi e hoʻokomo ai i ka ʻike. He lepili (hua ʻōlelo paʻa) a me kahi pihi. Ke paʻi mākou i ka pihi, e hōʻike ka Label i nā mea a mākou i kākau ai i ka TextField. E hana i kēia e hana mākou i nā loli e kuhikuhi i ka Label a me ka TextField i kā mākou ViewController a e kuhikuhi mākou i Interface Builder i ka pilina ma waena o ka Label a me ka TextField me kēia mau loli. Pono mākou e hana i kahi hana i ka ViewController nona ke kuleana no ka hoʻohou hou ʻana i ka waiwai Label me nā mea a mākou i komo ai i ka TextField, a pili i ka pihi i kēlā hana i Interface Builder. ʻO nā ʻanuʻu ʻekolu, 3 a me 4 o kā mākou palapala mua, a e wehewehe ʻia i ka pou aʻe.

ʻOiaʻiʻo, ma mua o ka hoʻopau ʻana e paipai wau iā ʻoe e nānā i nā mea i hōʻike ʻia i ka paleta Waihona puka ke koho ʻoe, no ka laʻana, kahi TextField e hoʻohui iā ia i ka ʻike.

Hiki iā ʻoe ke ʻike e wehewehe i ka hana a ka mana TextField, akā ʻōlelo pū kekahi ʻo "UITextField" ma lalo. He mea nui kēia, no ka mea ke haʻi mai nei iā mākou i ka papa o ka papahana Cocoa UIKit e kūlike me kēia kaohi. Hāʻawi kēia iā mākou i kahi hint: i mea e hana ai i ka loli e lawelawe i kēia kaohi ma ka ViewController, pono ia e lilo i ʻano UITextField.


Hoʻopili ka ʻike o ka ʻatikala i kā mākou kumumanaʻo o ka hoʻoponopono hoʻoponopono. E hōʻike i kahi kaomi hemahema ʻaneʻi.

7 manaʻo, waiho i kāu

E waiho i kāu manaʻo

Kāu leka uila aae? E,ʻaʻole e paʻiʻia.

*

*

  1. Ke kuleana o ka ʻikepili: AB Internet Networks 2008 SL
  2. Ke kumu o ka ʻikepili: kaohi SPAM, hoʻokele ʻōlelo.
  3. Legitimation: Kou ʻae
  4. Ka kamaʻilio ʻana o ka ʻikepili: ʻaʻole e hōʻike ʻia ka ʻikepili i nā ʻaoʻao ʻekolu koe ka mana o ke kānāwai.
  5. Pūnaewele mālama: Pūnaewele i mālama ʻia e Occentus Networks (EU)
  6. Nā Kuleana: I kēlā me kēia manawa hiki iā ʻoe ke palena, hoʻōla a kāpae i kāu ʻike.

  1.   serafin50 ia

    ʻO ka wiwo ʻole, ke hana ikaika nei ʻoe! Maikaʻi ke nānā aku 🙂

    Aloha.

  2.   kamaʻilio ia

    Ua hoʻāʻo paha (a kūleʻa paha) e hoʻouka Leopard ma lalo o vmware e hāhai i kēia aʻo aʻo hoʻomohala?

    A i ʻole he mac kāu āpau ma ka home?

    Mahalo.

  3.   ʻO TechnopodMan ia

    Maʻaneʻi Mac ...

    E hoʻomau i ka hana maikaʻi, ke hoʻomaka nei wau i ka pepeke e hoʻomaka e hana i nā mea ...

    Nui nā ʻike i ka ʻōlelo Pelekania, akā ʻaʻohe mea maikaʻi ma mua o kā mākou ʻōlelo ʻōiwi 😉

    Mahalo a aloha,

  4.   ʻO Javier Echeverría Usúa ia

    @resaka: i kaʻu hihia e hoʻohana wau iā Mac, e kala mai iaʻu ʻaʻole hiki iaʻu ke kōkua iā ʻoe ...

  5.   Sakery ia

    Lilo ka manawa nui i ka hoʻāʻo ʻana e hana maikaʻi i ka virtualization, haʻi wau iā ʻoe mai ka ʻike. ʻO ka mea maikaʻi loa e kiʻi i kahi G4 ma ebay, e hoʻouka i ka Leopard, ka SDK, i kekahi mau hoʻoponopono e hana ia ma lalo o kahi un-intel unu lawelawe (inā ʻaʻole ʻoe e ʻike, hana wale ka sdk ma Mac-Intel 😉) a … Nā hopena i hōʻoia ʻia. 🙂

  6.   kamaʻilio ia

    Mahalo nui iā TechnopodMan, Javier lāua ʻo Sakery no ka pane ʻana mai. E hoʻomau wau i ka hoʻāʻo ʻana i ka hoʻouka uila.

    Eia naʻe, e nānā wau i ke koho āu e ʻai ai iā Sakery, ʻoiai ke nānā nei i nā kumukūʻai o G4 me he mea lā ʻaʻole kiʻekiʻe loa (ma waena o 100 a me 300).

    Mahalo oe.

  7.   mea wehe laka ia

    E hoʻāʻo e ʻimi i ka pūnaewele no ka hackintosh. (EJ IATKOS)
    Hoʻohana ʻia ia e hoʻouka iā MAC OS ma PC.
    Aloha.