2012-08-09 69 views
0

我有一个关于UIImageView和UIImage的问题我对1件事感到困惑,例如我的“UIImageView Height = 759和Width = 748”我正在从服务器下载图像高度和宽度是如此如此较大的如“图像高度= 2048和Width = 2500”我传递给CGimage高度n宽度的哪个参数

让我有点迷惑,而渲染上的UIImageView图像我传递参数到CGImage

我将参数传递给CGImage,如下所示

CGImage _bitmap = new CGImage (2048 , 2500 , 8 , 32 , 2048 * 4 , _colorSpace , CGBitmapFlag.ByteOrderDefault , null, true , CGColorRenderingIntent.Default); 

我通过在CGImage()的类型参数的意思我通过图片参数或UIImageView的参数CGImage让我的形象将正确渲染成UIImaeView

回答

0

我不认为你应该费心使用CGImage在所有(除非你特别有内存问题)。

只是这样做:

UIImage yourImage; 
//Download from your server here (I can fill it in if needed) 
UIImageView imageView = new UIImageView(new Frame(0, 0, 748, 759)); //This can also be setup in a XIB file 
imageView.ContentMode = UIViewContentMode.ScaleAspectFit; 
imageView.Image = yourImage; 

玩的内容模式设置,以获得您需要什么。

Here是内容模式的链接。

+0

感谢您的rlpy我知道内容模式属性,但它的工作图像不适合UIImageVIew – IMMORTAL 2012-08-09 13:44:33

+0

当你尝试这种方法会发生什么?屏幕是什么样子的,你可以发布一个屏幕截图吗?这种方法应该适合你。 – jonathanpeppers 2012-08-09 14:14:31

+0

为什么不,但检查此链接,以便您可以找到屏幕截图:-http://monotouch.2284126.n4.nabble.com/How-to-display-12-bit-images-in-UIImageView-td4656427 .html – IMMORTAL 2012-08-10 11:13:06

相关问题