Imm*_*009 4 iphone syntax objective-c ipad ios
我在我的一个项目中使用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)
这些是数组文字,一种容器文字,可在Xcode 4.4及更高版本中使用.
看到:
归档时间: |
|
查看次数: |
2476 次 |
最近记录: |