search

Home  >  Q&A  >  body text

ios - 颜色渐变问题

大家讲道理大家讲道理2892 days ago320

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-18 09:28:29

    When NSArray is initialized via @[] syntax, it is necessary to ensure that all elements are not nil.
    You need to determine in advance whether the element is nil

    if((_inputColor0.CGColor && _inputColor1.CGColor)) {
        NSArray *colors = @[(__bridge id)_inputColor0.CGColor, (__bridge id)_inputColor1.CGColor];
    }
    

    reply
    0
  • Cancelreply