如何在IBAction中实现NSArray方法?
我一直在阅读此线程中向我建议的代码: 如何从 UIImage (Cocoa Touch) 或 CGImage (Core Graphics) 获取像素数据?
我想知道如何通过以下方式实现代码:
-(IBAction)getRGB:(id)sender {
// Call getRGBAsFromImage here when pressed.
}
+ (NSArray*)getRGBAsFromImage:(UIImage*)image atX:(int)xx andY:(int)yy count:(int)count {
...
}
谢谢你很 很多。
编辑 0x90:
-(IBAction)getRGB:(id)sender {
UIImage *image = [UIImage imageNamed:@"IMG_0121.JPG"];
[self getRGBAsFromImage:image atX:40 andY:40 count:40];
}
I have been reading the code that was suggested to me in this thread here: How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?
I am wondering how I would implement the code in the following manner:
-(IBAction)getRGB:(id)sender {
// Call getRGBAsFromImage here when pressed.
}
+ (NSArray*)getRGBAsFromImage:(UIImage*)image atX:(int)xx andY:(int)yy count:(int)count {
...
}
Thank you very much.
Edit for 0x90:
-(IBAction)getRGB:(id)sender {
UIImage *image = [UIImage imageNamed:@"IMG_0121.JPG"];
[self getRGBAsFromImage:image atX:40 andY:40 count:40];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以定义一个强/保留(取决于您是否使用 ARC)属性来存储返回的 NSArray ,然后调用该方法,如下所示:
You would define a strong/retained (depends on whether you use ARC) property to store the returned
NSArray
and then call the method as such: