开发者

iPhone:How to dynamically set UIImage size , width , height and orientation?

开发者 https://www.devze.com 2023-03-26 17:52 出处:网络
I want to develop functionality such that to set size , width , height & orientation of UIImage dynamically in iPhone so 开发者_StackOverflowplease tell me any link or any idea to develop this fun

I want to develop functionality such that to set size , width , height & orientation of UIImage dynamically in iPhone so 开发者_StackOverflowplease tell me any link or any idea to develop this functionality.


You can use UIImageView:

//get the Image
UIImage *img = [UIImage imageNamed:@"img.png"];
//create a UIImageView
UIImageView *imageView = [[[UIImageView alloc] initWithImage:img] autorelease];
imageView.frame = CGRectMake(x, y, width, height); //set these variables as you want


I don't think anyone really understands your question, however:

size: (replace the width/height values wth your own)

myImageView.frame = CGRectMake(myImageView.frame.origin.x, myImageView.frame.origin.y,width,height);

orientation

float angleInDegrees = 90; // change this value to what you want
float angleInRadians = angleInDegrees * (M_PI/180);
myImageView.transform = CGAffineTransformMakeRotation(angleInRadians);
0

精彩评论

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