我在頭文件中創建了常量多維數組。我想從實現中訪問數組。怎麼做?如何訪問目標c中頭文件中定義的常量數組?
的config.h
#define SORT_OPTIONS @[ \
[ @3, @"Default", @"&sort=p.sort_order&order=ASC" ], \
[ @1, @"Product Name (A - Z)", @"&sort=pd.name&order=ASC" ], \
[ @2, @"Product Name (Z - A)", @"&sort=pd.name&order=DESC" ], \
[ @3, @"Low price > High price", @"&sort=p.price&order=ASC" ], \
[ @3, @"High price > Low price", @"&sort=p.price&order=DESC" ]]
Config.m
#import "Config.h"
@implementation Config
+ (void) initSortOptionsAsSortObject{
// I want access array from here
}
@end
你試過記錄它嗎?的NSLog( 「%@」,SORT_OPTIONS)? – Joshua
這是沒用的... – hkaraoglu
我其實已經試過了,它的工作原理: – Joshua