开发者

iOS How to get contact image full screen

开发者 https://www.devze.com 2023-03-19 00:01 出处:网络
The AddressBook framework provides ABPersonCopyImageData for getting the contact image for each address book entry. However this API returns original image size which is way too big to display on scre

The AddressBook framework provides ABPersonCopyImageData for getting the contact image for each address book entry. However this API returns original image size which is way too big to display on screen. How does one get a full screen image? Below is the code I am using

             NSData *contactImageData = (NSData*)ABPersonCopyImageData(personRef);
             UIImage *img = [[UIImage alloc] initWithData:contactImageData];

             self.backgroundImage.image = img; 
             [img release];
             [contactImageData release];

where self.backgroundImage is a UIImageView set up in I开发者_JAVA技巧B with frame rectangle 320x460

Thanks


Just setup your UIImageView frame to be full screen. Then whatever picture you will display in it should be full screen. It will automatically get downsized for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消