Hi I am new to iPhone.
What I need is, have to display only one image in one case, two images in another case like wise and for that I am using a UIImageview with IBOutlet.
How can I display multiple images in single imageview?
Please help me post some code.
Thank you.
An UIImageView can only display one image at a time. You will either have to use several UIImageViews or compose your images into one file before displaying it.
I think you should subviews ot type UIImageView to your main UIImageView.
The "hard" task will be to compute the boundaries of each subview, according to the prefered layout. Use the image property of UIImageView to set the image for each subview (don't worry about resizing, UIImageView will do the work for you)
Related
I want to use a UIProgressView but I want the background to be an image to make things a bit more good looking. I'm not sure how to lay one over the other. It would be important for the background image to encompass the UIProgressView.
Any help appreciated.
You can simply create a UIImageView for your background image, then add a UIProgressView as a sub view.
You can do this in either Interface Builder or in code such as [myBackgroundImageView addSubView:myProgressView];
Obviously you will need to setup the correct frame for both to ensure they are in the correct position.
Check out addSubview: in the Apple reference.
i'm looking for a way to draw multiple images (downloaded from a webservice) inside a single uiimageview. So it'd go like i downloaded image #1, and i'd like to draw it inside rect (0,0,100,100) then #2 at (0,100,100,100) etc.
I'd like to then be able to take the entire composition and save it as an image in camera roll.
thanks in advance for help
greetings
peter
Just create a UIView, then add multiple UIImageViews as subviews.
You may use CGImageCreateWithImageInRect to extract an image from the UIView.
I've created a NIB file with some button controls on it, and as a background it has an ImageView which contains a PNG file loaded from my project.
What I want to do is to draw on top of the ImageView - imagine that my UI is a clockface and I want to draw the hands of the clock on top of the background image.
Is it the correct approach to try to subclass the UIImageView and use its DrawRect as when I use the DrawRect of the default view I don't see anything on the screen?
I'm a little lost as I'm finding this particular bit of the documentation hard to follow.
Thanks.
Create a new custom UIView (e.g. named HandsView) that sits on top of your background view (by adding it as a subview of the UIImageView). In the custom view, you can use the drawRect method. Make sure, you clear the context to transparent, so that the background image can be seen below the HandsView.
If you just want to draw turning hands, you can also try to use two fixed UIImageViews with the images of the hands and use the transform property to apply a rotation.
I'm using a sectioned TableView, and I want to show an image on the left side of the cell.
If I pick one from the photo library (out of the example photos in simulator) and set it as UITableViewCell.imageView.image, it takes up the whole screen.
How can I resize the image so that it fits exactly into the cell's image view?
Thanks,
Yassin
This is basically the same question as How to scale a UIImageView proportionally ?, which has a good answer.
Add that category to your project and call it with the size of your view. I've used the code and it works well.
set a UIImageView.image property to a UIImage is unable add the image to the view,however if i set the imageview frame property,it works.can anyone tell me how it's happen?
and what will happen when i apply the UIImage instance method[drawInRect:] redraw the image frame which is larger than the view frame?i have tried but nothing happen,and what is this function doing actual?
Generally, how it works is, you add an Image to a UIImageView and then add the UIImageView to a UIView to display it on the screen. You can do this programmatically, or using Interface Builder. Optionally, you can create a CGRect (based on a frame, if you like), use this as the bounds for the UIImageView (or you can frame the UIView). There are several ways to do what you want to do.
It's hard to tell without seeing your code. It could be a number of things. You could be inserting the view with the image behind the currentView? You may not be retaining the UIImageView. We can't read minds here necessarily, (sometimes we do). But you'll need to be more helpful if you want a solid answer.
Or just take a look at this:
UIImageView Docs