I am new to iPhone programming.
I want to get the height and width of a image, so I can set the frame of UIImageview
accordingly.
Any suggestions how can I get the original size (width and height) of image?
i 电话获得图像宽度和大小
原标题:iPhone get image width and size
最佳回答
如果您的图像为<代码>UIImage,那么你想看<代码>size。 财产:
CGFloat width = myImage.size.width;
CGFloat height = myImage.size.height;
问题回答
你可以试图检查
[[UIImage imageNamed:@"myImage.png"] size].height; [[UIImage imageNamed:@"myImage.png"] size].width;
或许这也有助于你:
UIImage *image = [ UIImage imageNamed: @"image.png" ];
imageView.bounds = CGRectMake(0, 0, image.size.width, image.size.height);
www.un.org/Depts/DGACM/index_spanish.htm 请问:
image.size.height;
image.size.width;
[[UIImage imageNamed:@"image.png"] size].height;
[[UIImage imageNamed:@"image.png"] size].width;
相关问题
热门标签
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding