キリンめも(技術)

記事を書いています #rails #swift #JS #UE4 #unity

objectiv-c グローバル変数の作り方

メモ書きです。グローバル変数使いたかったので・・・

 

3ステップ

1appDelegate.hに 宣言する @interface AppDelegate...{NSString * hoge}

21の下に@property (nonatomic, retain) NSString * hoge;

3使用方法(保存します)[.m]

AppDelegate* delegate = [[UIApplication sharedApplication] delegate];
delegate.gText = hoge;

 

 

参考サイト様

アプリ開発の基本〜グローバルな変数の使い方 : iPhoneアプリ開発日誌