0

i have a custom tabBar class in which i switch three view controllers ,i am removing the presentview controller and presenting the other .
custom tabbar class
-list
-inbox
-messages
now i have to pass an array from list to inbox i usually create an instance of the recieving class like

Inbox *inbox=[[Inbox alloc]init];
inbox.array=self.array;  
but in this case its not working.the array in inbox class returns null when i nslog it
SNR
  • 1,249
  • 2
  • 20
  • 38
sujith1406
  • 2,822
  • 6
  • 40
  • 60
  • See post: http://stackoverflow.com/questions/4478511/passing-array-between-view-controllers – petert Jan 21 '11 at 08:59

3 Answers3

0

Check your property in Inbox class and check to see if self.array is not null.

Edit try: inbox.array = [NSArray arrayWithArray:self.array]

Alex Terente
  • 12,006
  • 5
  • 51
  • 71
  • self.array is not null..i have nslogged it ,and i have set the @property(nonatomic,retain)nsarray array in inbox class.is it any problem in changing the views....usually this worked when i used pushviewcontroller – sujith1406 Jan 21 '11 at 09:13
  • but the problem here seems to be inbox.array, that one is the one which doesn't look like it has been initialized. – JonLOo Jan 21 '11 at 09:37
0

Do you inherit or use the UITabBarController in your custom tabBar?

If you want to pass a variable between list<->inbox<->messages I would suggest that you implement a method in the tabBar that can be called from the subviews. The method would send the array to the appropriate subview.

Mani
  • 1,597
  • 15
  • 19
  • its a uiviewcontroller that follows tabbardelegate protocol .its similar to http://www.wiredbob.com/blog/2009/4/20/iphone-tweetie-style-navigation-framework.html. – sujith1406 Jan 21 '11 at 09:26
0

ok this worked when i passed the value to applicationdelegate and from the other class accessed from here.

sujith1406
  • 2,822
  • 6
  • 40
  • 60