我目前有代码接受UIImage并返回NSArray
-(NSArray*)getPixelsFromImage:(UIImage*)image
{
NSMutableArray *pixelData=[NSMutableArray new];
for (int y = 0; y<image.size.height; y+=1) {
for (int x = 0; x<image.size.width; x+=1) {
CGImageRef tmp = CGImageCreateWithImageInRect(image.CGImage, CGRectMake(x, y, 1, 1));
UIImage *part=[UIImage imageWithCGImage:tmp];
[pixelData addObject:part];
}
}
return [pixelData copy];
}
我想知道如何将NSArray返回并将其转换为整数数组?