static NSDictionary* const letterValues = @{ … } in a method does not compile

后端 未结 4 1453
南方客
南方客 2021-02-05 13:20

In a word game for iPhone:

\"app

I\'m trying to use the following code in my custom view Tile.

4条回答
  •  臣服心动
    2021-02-05 13:31

    Another alternative is using the Macro Approach:

    Macro (The Easiest) Approach (2020)

    #define kScreenNames @{ \
            @"HOME":                     @"Home Page", \
            @"SEARCH":                   @"Search Page", \
            @"MYLISTS":                  @"My List", \
            @"MYACCOUNT":                @"My Aaccount" \
    }
    

    it's short and elegant.

    Then, you can use it like any other NSDictionary.

    I hope this will help someone on the planet.

    Best Regards

提交回复
热议问题