开发者

creating objects within a block

开发者 https://www.devze.com 2023-01-23 03:07 出处:网络
[myArray enumerateObje开发者_开发知识库ctsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [[myTreeNode mutableChildNodes] addObject:[NSTreeNode treeNodeWithRepresentedObject:obj]];
[myArray enumerateObje开发者_开发知识库ctsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        [[myTreeNode mutableChildNodes] addObject:[NSTreeNode treeNodeWithRepresentedObject:obj]];
        //myTreeNode is an NSTreeNode
    }];

Is it ok to create objects from within a block?


Yes. It's basically OK to do anything in a block that you might do in a normal function.

0

精彩评论

暂无评论...
验证码 换一张
取 消