IOS:一个特殊的语法@[]

来源:互联网 发布:汇川plc编程软件安装 编辑:程序博客网 时间:2024/05/20 10:52

今天偶然发现一个特殊的语法,使用@[ ]可以将viewcontroller转换成NSArray,这里有一个官方例子:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

   // kick things off by making the first page

   PhotoViewController *pageZero = [PhotoViewControllerphotoViewControllerForPageIndex:0];

    

   // assign the first page to the pageViewController (our rootViewController)

   UIPageViewController *pageViewController = (UIPageViewController *)self.window.rootViewController;

    pageViewController.dataSource =self;

    

    [pageViewControllersetViewControllers:@[pageZero]

                                 direction:UIPageViewControllerNavigationDirectionForward

                                  animated:NO

                                completion:NULL];

    

   return YES;

}

这里只知道大概可以这么用,具体严格的意义还有待考究,有哪位知道这个知识点的请不吝赐教。