Can’t add a corner radius and a shadow

Yes, yes there is… If you want both a corner radius and a drop shadow, you don’t turn on -masksToBounds, but rather set the corner radius and set the bezier path of the shadow with a rounded rect. Keep the radius of the two the same: [layer setShadowOffset:CGSizeMake(0, 3)]; [layer setShadowOpacity:0.4]; [layer setShadowRadius:3.0f]; [layer setShouldRasterize:YES]; … Read more

Convert unsigned char array to NSData and back

You can just use this NSData class method + (id)dataWithBytes:(const void *)bytes length:(NSUInteger)length Something like NSUInteger size = // some size unsigned char array[size]; NSData* data = [NSData dataWithBytes:(const void *)array length:sizeof(unsigned char)*size]; You can then get the array back like this (if you know that it is the right data type) NSUInteger size = … Read more