Pass NSMutableArray to one view controller to another

前端 未结 6 1318
-上瘾入骨i
-上瘾入骨i 2020-12-22 13:49

I am trying to pass a NSMutableArray between two view controller. Please let me know what can i do for this

In the PlaylistViewController.h file I have



        
6条回答
  •  我在风中等你
    2020-12-22 14:27

    **FirstViewController.h**
    
    @interface FirstViewController : UIViewController
    {
        NSMutableArray *SongArray;
    }
    @property(nonatomic,retain)NSMutableArray *SongArray;
    
    **FirstViewController.m**
    
    SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];    
    secondView.SongArray = self.SongArray;
    
    [self.navigationController secondView animated:YES];
    
    
    **SecondViewController.h**
    
    @interface SecondViewController : UIViewController
    {
        NSMutableArray *SongArray;
    }
    @property(nonatomic,retain)NSMutableArray *SongArray;
    

提交回复
热议问题