views:

38

answers:

1

how do were clear an NSMutatableData wihtout using release and then re-alloc/init again to be used again? I was looking at resetBytesInRange to be set at zero but I am unsure of this. Anyone can help?

+7  A: 

If you want an empty buffer:

[data setLength:0];

If you want to keep its size but set all the bytes to zero:

[data resetBytesInRange:NSMakeRange(0, [data length])];
benzado