今天偶然发现一个特殊的语法,使用@[ ]可以将viewcontroller转换成NSArray,这里有一个官方例子:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// kick things off by making the first page
PhotoViewController *pageZero = [PhotoViewController photoViewControllerForPageIndex:0];
// assign the first page to the pageViewController (our rootViewController)
UIPageViewController *pageViewController = (UIPageViewController *)self.window.rootViewController;
pageViewController.dataSource = self;
[pageViewController setViewControllers:@[pageZero]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:NULL];
return YES;
}
这里只知道大概可以这么用,具体严格的意义还有待考究,有哪位知道这个知识点的请不吝赐教。