Advertisement
alex1984vn

iphone share view variables

Apr 3rd, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. You can put your widget class as a property on the Application Delegate.
  2.  
  3. @interface youAppDelegate : NSObject <UIApplicationDelegate> {
  4.    Widget *myWidget;
  5. }
  6.  
  7. @property (readonly) Widget *myWidget;
  8.  
  9. @end
  10.  
  11. Then, instantiate it on the message "applicationDidFinishLaunching" of your application's delegate.
  12.  
  13. Once you've done that, you can access myWidget from anywhere in the project like this:
  14.  
  15. youAppDelegate *ad = (youAppDelegate*)[UIApplication sharedApplication].delegate;
  16. Widget *w = [ad myWidget];
  17.  
  18. That code can be perfectly compiled and executed at viewController1, viewController2 or even on the tabBarController.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement