How can add more space if NSData < fixed size in Cocoa
问题 I have a problem: I used below codes to get data from NSData , but I want to get data from [0;2048] bytes . If my data > 2048* strong text *, it can run fine but if my data < 2048 , it'll wrong. So that I want to add more some space at last if my data < 2048 to enough 2048 bytes . Can you help me? Thanks so much. NSData *data = [NSData dataWithBytes:[arrayText UTF8String] length:[arrayText lengthOfBytesUsingEncoding:NSUTF8StringEncoding]]; NSData *datawrite = [data subdataWithRange