How to passing a NSMutableArray to another ViewController class

前端 未结 4 1684
南方客
南方客 2021-01-15 05:23

I have created NSMutale Array in \"HeroListViewController\". I want use it in another viewController which is MapTutorialViewController. I

4条回答
  •  孤街浪徒
    2021-01-15 06:08

    Example

    firstviewcontroller .h file
    
            before @interface 
    
            use @class secondViewcontroller;
    
    
    declare this inside of @interface  with
    
            secondViewcontroller *sVC;
    
    
    then in firstViewController.m file 
    
            before @implementation          
    
        #import "secondViewcontroller.h"
    
    then
    -------------------
    
    secondVC.h file
    
            @interface inside declare this
    
            say NSMutableArray *secondarray;
    
            and sythasize them.
    
    ------------------- 
    
    after this 
    
            in firstViewcontroller.h viewdidload create this sVC by alloc and initwithnibname then
    
            sVC.secondArray=urfirstArray;
    
            now while u push this sVC controller to navigation controller u can nslog this array in viewdidload.
    

提交回复
热议问题