相关疑难解决方法(0)

奇怪的objective-c语法 - 方括号和@符号

我在我的一个项目中使用GHSidebarNav,我遇到了这个代码分配一个对象数组.我只是不知道它在做什么.它只是一个阵列吗?这个奇怪的@[...]语法是什么?我之前没见过:

NSArray *controllers = @[
    @[
        [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Profile" withRevealBlock:revealBlock]]
    ],
    @[
        [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"News Feed" withRevealBlock:revealBlock]],
        [[UINavigationController alloc] initWithRootViewController:[[GHMessagesViewController alloc] initWithTitle:@"Messages" withRevealBlock:revealBlock]],
        [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Nearby" withRevealBlock:revealBlock]],
        [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Events" withRevealBlock:revealBlock]],
        [[UINavigationController alloc] initWithRootViewController:[[GHRootViewController alloc] initWithTitle:@"Friends" withRevealBlock:revealBlock]]
    ]
];
Run Code Online (Sandbox Code Playgroud)

iphone syntax objective-c ipad ios

4
推荐指数
1
解决办法
2476
查看次数

2
推荐指数
1
解决办法
6113
查看次数

标签 统计

ios ×2

ipad ×2

iphone ×2

objective-c ×2

syntax ×1

xcode ×1