开发者

passing array from one viewcontroller to another

开发者 https://www.devze.com 2023-02-06 03:22 出处:网络
i have a custom tabBar class in which i switch three view controller开发者_如何学JAVAs ,i am removing the presentview controller and presenting the other .

i have a custom tabBar class in which i switch three view controller开发者_如何学JAVAs ,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


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.


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

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消