How do I declare an array as a constant in Objective-c?

前端 未结 6 897
旧巷少年郎
旧巷少年郎 2020-11-29 01:42

The following code is giving me errors:

//  constants.h
extern NSArray const *testArray;
//  constants.m
NSArray const *testArray =          


        
6条回答
  •  感情败类
    2020-11-29 02:32

    It's pretty easy :

    #define arrayTitle [NSArray arrayWithObjects: @"hi",@"foo",nil]

    put before implementation and without semicolon.

    hope it helps.

提交回复
热议问题