ios - How can I use methods defined in this delegate? -


i'm new ios development, , i'm playing interface trying understand concepts. provided sdk(which compiled , can't it) has following definitions:

@class hrmonitor; @protocol hrmonitordelegate - (void) hrmon: (hrmonitor*) mon heartrateupdate: (double) hr; // , others @end  @interface hrmonitor : nsobject <nsstreamdelegate>{ }  -(id) init: (id) _delegate; -(void)startup; 

does have idea how can use heartrateupdate method defined in protocol hrmonitordelegate? read in ios developer library, have have interface conforms delegate hrmonitor : nsobject <hrmonitordelegate> call methods in protocol. that's not provided in api.

or can use init method? how should pass _delegate?

  1. conform interface delegate

  2. init hrmonitor, passing interface instance _delegate

  3. then - (void) hrmon: (hrmonitor*) mon heartrateupdate: (double) hr of interface called

  4. make interface conforms delegate, , call method of when need, remember check delegate not nil , response method want call

    @interface yourclass : nsobject <hrmonitordelegate>  @implementation hrmonitor   -(void)somemethod  {     hrmonitor monitor = [hrmonitor alloc] init:self];   }  - (void) hrmon: (hrmonitor*) mon heartrateupdate: (double) {  } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -