我在我的一個項目中使用GHSidebarNav,並且遇到了分配對象數組的代碼。我只是不知道它在做什麼。它只是一個數組?這是什麼奇怪的@[...]
語法?我之前沒有看到:奇怪的objective-c語法 - 方括號和@標誌
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]]
]
];
http://stackoverflow.com/questions/25749/what-does-the-sym bol-represent-in-objective-c –
@RobertHarvey您的鏈接沒有提及新的數組文字語法。 – rmaddy