在 MonoTouch 中获取人物的裁剪照片(在 iPhone 上)
我可以从地址簿中获取人的原始图像,但我想问,是否有任何方法可以获取裁剪图像(以防用户拍摄了照片并仅缩放了其中的一部分)。我找到了一种方法,如何在 Objective-C 中执行此操作:
NSData *imageData = [(NSData *)ABPersonCopyImageDataWithFormat(
recordRef, kABPersonImageFormatThumbnail) autorelease];
我找不到在 MonoTouch 中获取此缩略图的方法。我发现这个枚举肯定与此有关,但没有其他:(
http://docs.go-mono.com/MonoTouch.AddressBook.ABPersonImageFormat/Members
请问,有人有什么想法吗? 提前致谢
I'm able to get original image of person from address book but I would like to ask, if there is any way how to get cropped image (in case, user has taken a picture and zoomed just some part of it). I found a way, how to do this in objective-c:
NSData *imageData = [(NSData *)ABPersonCopyImageDataWithFormat(
recordRef, kABPersonImageFormatThumbnail) autorelease];
I can't find a way how to get this thumbnail in MonoTouch. I found just this enumeration which has definitely something to do with that, but nothing else :(
http://docs.go-mono.com/MonoTouch.AddressBook.ABPersonImageFormat/Members
Please, has anybody any idea?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
MonoTouch.AddressBook.ABPerson.Image
属性。以及MonoTouch.AddressBook.ABPerson.HasImage
属性,以确保MonoTouch.AddressBook.ABPerson
具有图片。Try
MonoTouch.AddressBook.ABPerson.Image
propery. AndMonoTouch.AddressBook.ABPerson.HasImage
property to shure thatMonoTouch.AddressBook.ABPerson
has a picture.当您右键单击 ABPerson 实例的 Image 属性,然后选择“转到声明”时,您将找到 Monotouch 为此属性实现的代码:
}
您会看到 ABPerson.ABPersonCopyImageData 方法用于返回 Image,因此有一种获取图像的方法,但我认为它被标记为“内部”。
所以我认为我们需要自己绑定 Objective C 函数。有没有人知道如何做到这一点或有这方面的经验?
When you right-click on the Image property of an ABPerson instance and then select 'Go to declaration', you will find the code Monotouch implements for this property:
}
You see that a ABPerson.ABPersonCopyImageData method is used to return the Image, so there is a method to get the image, but I think it is marked Internal.
So I think we need to Bind the Objective C functions ourself. Is there anybody out there who knows how to do this or has any experience with this?