美文网首页iOS开发Objective-C iOS
iOS数组makeObjectsPerformSelector:

iOS数组makeObjectsPerformSelector:

作者: _浅墨_ | 来源:发表于2016-01-26 10:27 被阅读1411次
    一. 数组的makeObjectsPerformSelector:SEL方法来减少自己写循环代码.
     [self.answerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
     
    
     1.  makeObjectsPerformSelector:@select(aMethod)
    
         简介:让数组中的每个元素 都调用 aMethod 
    
     2.  makeObjectsPerformSelector:@select(aMethod) withObject:oneObject
    
         简介:让数组中的每个元素 都调用 aMethod  并把 withObject 后边的 oneObject 对象做为参数传给方法aMethod
    
    [array makeObjectsPerformSelector:@selector(setRecurringDelegate:) withObject:self]; /*将检测到的该自动插入的交易插入数据库*/
     
    [array makeObjectsPerformSelector:@selector(insertRecursion)];
    /*将检测到的该自动插入的交易插入数据库*/
         
    
    

    相关文章

      网友评论

      • zxcgetSomthing:tabview 中用了好几句 [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 为了防止复用的问题。但是我想问这句会不会比较消耗性能,有点担心
        benlue:@_浅墨_ 用block循环, id指针调removeFromSuperview方法会更加高性能
        _浅墨_:@zxcgetSomthing 会的,你发现有更好方法可以说下,:blush:

      本文标题:iOS数组makeObjectsPerformSelector:

      本文链接:https://www.haomeiwen.com/subject/zirdkttx.html