Dab tsi yog raws tu qauv thiab delegate hauv Swift?
Dab tsi yog raws tu qauv thiab delegate hauv Swift?

Video: Dab tsi yog raws tu qauv thiab delegate hauv Swift?

Video: Dab tsi yog raws tu qauv thiab delegate hauv Swift?
Video: Yog ntuj tsis pab ntshe kuv tuag lawm 8/6/2018 2024, Kaum ib hlis
Anonim

Kev xav tau: a raws tu qauv

Delegation yog ib qho qauv tsim uas ua rau cov chav kawm lossis cov qauv tsim tawm (lossis tus sawv cev ) qee qhov ntawm nws lub luag haujlwm rau ib qho piv txwv ntawm lwm hom

Ua raws li qhov pom no, dab tsi yog tus sawv cev hauv Swift?

Kev ua delegates hauv Swift , ib kauj ruam ntawm kauj ruam. Cov neeg sawv cev yog cov qauv tsim uas tso cai rau ib qho khoom xa xov mus rau lwm yam khoom thaum muaj xwm txheej tshwj xeeb tshwm sim. Xav txog tej yam khoom A hu ib yam khoom B los ua ib qho kev ua.

Tsis tas li, kuv yuav siv cov neeg sawv cev hauv Swift li cas? Cov kauj ruam yooj yim los siv delegation yog tib yam rau Objective-C thiab Swift:

  1. Tsim tus delegate raws tu qauv uas txhais cov lus xa mus rau tus delegate.
  2. Tsim ib tug delegate vaj tse nyob rau hauv lub delegating chav kawm ntawv kom taug qab tus delegate.
  3. Txais thiab siv tus delegate raws tu qauv hauv chav delegate.

Raws li txoj cai, Swift yog dab tsi?

Cov txheej txheem . A raws tu qauv txhais ib daim qauv ntawm txoj kev, cov khoom, thiab lwm yam kev xav tau uas haum rau ib qho haujlwm tshwj xeeb lossis cov haujlwm ua haujlwm. Cov raws tu qauv Tom qab ntawd tuaj yeem raug coj los ntawm chav kawm, qauv, lossis kev suav sau los muab kev ua tiav ntawm cov kev xav tau.

Dab tsi yog delegate thiab raws tu qauv hauv iOS?

Cov neeg sawv cev yog siv cov lus feature ntawm cov txheej txheem . Cov pawg neeg sawv cev tsim qauv yog ib txoj hauv kev tsim koj cov cai siv cov txheej txheem qhov tsim nyog. Hauv Cocoa moj khaum, lub tus sawv cev tus qauv tsim yog siv los qhia qhov piv txwv ntawm cov chav kawm uas ua raws li qhov tshwj xeeb raws tu qauv.

Pom zoo: