美文网首页
ios 遍历makeObjectsPerformSelector

ios 遍历makeObjectsPerformSelector

作者: 1234yws | 来源:发表于2019-02-20 13:55 被阅读0次
    //集合或数组里面的每一个元素都去执行 aSelector
    - (void)makeObjectsPerformSelector:(SEL)aSelector NS_SWIFT_UNAVAILABLE("Use enumerateObjectsUsingBlock: or a for loop instead");
    
    //使用方法
    [self.smallScrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    //集合或数组里面的每一个元素都去执行 aSelector 。且把 withObject 后边的 argument 对象做为参数传给方法 aSelector。
    - (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(nullable id)argument NS_SWIFT_UNAVAILABLE("Use enumerateObjectsUsingBlock: or a for loop instead");
    
    //使用方法
    //argument作为对象参数传递给aSelector,然后循环之行
    [self.array makeObjectsPerformSelector:@selector(setHidden:) withObject:@YES];
    

    相关文章

      网友评论

          本文标题:ios 遍历makeObjectsPerformSelector

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