定数をインポートするすべてのクラスがそれらの値を使用できるように、iOS アプリの定数シングルトン クラス内でグローバル定数値を設定したいと考えています。
ただし、このアイデアで数時間遊んだ後でも、まだ機能させることができません。
私の Constants.m ファイルで
@interface Constants()
{
@private
int _NumBackgroundNetworkTasks;
NSDateFormatter *_formatter;
}
@end
@implementation Constants
static Constants *constantSingleton = nil;
//Categories of entries
typedef enum
{
mapViewAccessoryButton = 999
} UIBUTTON_TAG;
+(id)getSingleton
{
.....
}
定数シングルトンへの参照がある別のクラス MapViewController があり、このような列挙型にアクセスしようとしています
myDetailButton.tag = self.constSingleton.UIBUTTON_TAG.mapViewAccessoryButton;
ただし、これは機能していません。mapviewcontroller 内の UIBUTTON_TAG にアクセスできません
誰か提案はありますか?
ありがとう