How do you pass objects between View Controllers in Objective-C?

前端 未结 4 1966
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 15:52

I\'ve been trudging through some code for two days trying to figure out why I couldn\'t fetch a global NSMutableArray variable I declared in the .h and implemented in .m and

4条回答
  •  北海茫月
    2020-12-29 16:42

    There are global variables in Obj-C, you instantiate them in the App Delegate.

    But onto your problem you probably want to pass the NSMutableDictonary when you instantiate the new view controller like [UIView alloc] initWithDictionary:(NSMutableDictionary *)dict; if you know what I mean.

    In your example are you having a single class calling another class? I would think there is some kind of controller that determines which view controller to display and that would be the place to access and pass the dictionary

提交回复
热议问题