Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set UIImage frame

Tags:

iphone

uiimage

How i can set the frame size of UIImage.

like image 372
Mobile Developer iOS Android Avatar asked Jan 27 '11 10:01

Mobile Developer iOS Android


People also ask

How do I find my UIImage path?

Once a UIImage is created, the image data is loaded into memory and no longer connected to the file on disk. As such, the file can be deleted or modified without consequence to the UIImage and there is no way of getting the source path from a UIImage.

How do you declare UIImage in Objective C?

For example: UIImage *img = [[UIImage alloc] init]; [img setImage:[UIImage imageNamed:@"anyImageName"]]; My UIImage object is declared in . h file and allocated in init method, I need to set image in viewDidLoad method.

How do I add an image to UIImage?

With Interface Builder it's pretty easy to add and configure a UIImageView. The first step is to drag the UIImageView onto your view. Then open the UIImageView properties pane and select the image asset (assuming you have some images in your project).


1 Answers

You can set the frame of the UIImageView:

UIImageView* imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
imgView.image = [UIImage imageNamed:@"image.png"];

(and don't forget to [imgView release]; somewhere)

like image 68
phi Avatar answered Sep 28 '22 12:09

phi