search

Home  >  Q&A  >  body text

ios - 谁有研究过NSMutabelData中length与bytes的关系

1.length 是否为8bit为1个length
2.bytes是否和length相等
3.如果第一个问题成立那么一个lenth的意义或者代表的什么意思,为什么不用length取代bytes
4.bytes存在的意义

怪我咯怪我咯2772 days ago664

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 18:01:29

    length is an NSUInteger type data, representing the length of data, and bytes is a pointer, pointing to the content of data. There is no question of equality, inequality, or whether they can be replaced with each other.

    @property(readonly) NSUInteger length
    The number of bytes contained by the data object.
    
    
    @property(readonly) const void *bytes
    A pointer to the receiver’s contents. 
    

    reply
    0
  • Cancelreply