ios - How to call function from one viewcontroller to another controller? -


settingsstore.h

@interface settingsstore : iaskabstractsettingsstore     {           @public          nsdictionary *dict;          nsdictionary *changeddict;     }      - (void)removeaccount;     @end 

menuview.m

-(ibaction)onsignoutclick:(id)sender     {             settingsstore *foo = [[settingsstore alloc]init];         [foo removeaccount];         [self.navigationcontroller pushviewcontroller:foo animated:yes];            exit(0); } 

i want call removeaccount function menuview.m. getting error. enter image description here

how fix , call removeaccount.

there few mistakes in code please find them below.

  1. [foo removeaccount]; calling method correct
  2. [self.navigationcontroller pushviewcontroller:foo animated:yes];
    not correct because settingsstore not subclass of uiviewcontroller subclass of uiviewcontroller can pushed navigation controller
  3. exit(0); calling method not recommended apple

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -