Если вы знаете о делегате приложения, чем можете это сделать, объявите одну переменную, скажем, идентификатор пользователя целочисленный, чем указано ниже.
@interface YourAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
LenseCareViewController *viewController;
NSInteger intUserID;
}
@property (nonatomic,readwrite) NSInteger intUserID; //Synthesize this variable in implementation
//Your Header File
#import "YourAppDelegate.h"
@interface YourViewController : UIViewController
{
YourAppDelegate *appDelegate;
}
@property(nonatomic,retain) YourAppDelegate *appDelegate;
@end
//Your Implementation file
@implementation YourViewController
@synthesize appDelegate
- (void)viewDidLoad {
self.appDelegate = (YourAppDelegate*) [[UIApplication sharedApplication] delegate];
self.appDelegate.intUserID = 5; //Assign value to this variable and you can have access globally.
}
@end
Надеюсь, это поможет.Если есть сомнения, пожалуйста, оставьте комментарий.