I have an issue with uiimageviews resizing at run time. On one view I have more than a dozen uiimageviews contained within a uiscrollview. The images are assigned at design time. The uiimageview's are all the same size. The mode is set to Aspect Fill for all uiimageviews. At run time the images appear correctly in the view.
On a second view I have only 9 uiimageviews. These uiimageviews will display up to nine of the images selected from the first view. There are three images across and three images down. The uiimageview at design time is the same size as on the first view. The uiimageview image is assigned an image that is loaded into an array. All the uiimageviews are sized the same and they also have the mode set to Aspect Fill. The images are assigned at run time using image1.image = xxx. Where xxx is an image stored in an array.
However, on this second view, the images are not all the same size. The height of the image changes dynamically. The same image displayed in a different uiimageview on the view will be different sizes. It is the height of the uiimageview that changes. In some cases the image will fill the uiimageview differently. It is like the mode changes dynamically.
I've tried using different modes and nothing changes.
Any ideas on what is happening?
try resetting the frame of UIImageview's object (of same size which you set at the design time) after setting its image property...
Related
In ViewController I have a big ImageView whose image is captured with a ImagePicker. I want the user to be allowed to zoom in/out the image and then pan it but always inside the ImageView dimensions which must not enlarge, move or dwindle. I have seen I could add a ScrollView to ImageView but I can't figure out how to do that.
Moreover: is it possible to zoom in/out more than one ImageView at a time? I mean I have some smaller imageViews floating upon a bigger imageView. Is it possible to zoom everything all together?
There are plenty of excellent scrollview demo's around.
These will show you where and how to add override functions to implement what you need...
If you have different UIImage Views you can set the zoom programmatically to match the image being "zoomed" ... try experimenting with [UIImage].zoomScale. and the image offset. Its going to get complicated if they are different sizes as you will have to take account of scale when mirroring offset and zoom changes.
I have an easy task but still don't get how to make it work.
I have a UIView, inside the UIView i have the main UIImageView of half UIView size (half display).
And inside of the UIImageView i have two UIImageViews with images.
I need to pan the internal UIImageViews, and that's not a problem but the problem is that it will not go above the parent UIImageView borders. Same happens when i use two UIImage instead of UIImageView.
I have tried to bring it on top (bringSubviewToFront) but it does not help because its parent controller not the UIView. And the two internal UIImageViews must be a part of the main UIImageView because the main UIImageView can move, so i move all together.
Any help appreciated.
Although the correct solution is to have a superview that's the correct size, you can always "see" what lies outside of the bounds by setting clipsToBounds to NO on the parent UIImageView.
This will draw the subviews even if they lie outside the bounds of the superview. Keep in mind though, that the parts that are outside the bounds will not react to touches, i.e the hit box is always clipped.
You can have one parent view, containing large image and two smaller as siblings. Then you an control position of two images freely without attaching them to larger image.
Like this:
-Parent View (the largest, within which all images aare displayed)
- Large image
- small image
- small image
Now small images are free, and you can align them to large image whenever you want!
In one of my apps I am trying to combine two UIImageViews into a single UIImage. Bottom one is from the camera and the top one is something like a badge. The user can drag, rotate and scale the one at the top.
My question is, how can i save these two UIImageViews into a single UIImage at the end of all drag, rotate and scale operations?
Edit: I want to keep the original size of the bottom image.
This post : Saving UIView contents in iOS 4 with real size of the images inside (i.e. scale contentes up for save) shows how you can get a UIImage from any UIView.
Basically, you can adapt its solution, using a UIView container for your 2 UIImageViews.
So I have a UIButton, when said button is pressed a UIView is created which holds 10 UIImageViews, all of those have a size of 100x100. For every UIImageView there's an image with the size of 640x960, which I resize to fit the UIImageView. My problem is that every time I press the button there's a 1-2 second delay before the UIView gets created, but everything works fine if I remove the UIImageViews. Can anyone provide some help? Thanks in advance.
Loading and resizing 10 UIImageViews is going to cause delay. Create thumbnail versions of your images by pre-resizing them to 100x100 and load them instead of the large ones and there should be minimal delay.
I have a UIImageView that I dynamically load with an Image using
myTableViewCell.myImageView.image = [UIImage imageNamed:myImageFileName];
myImageView is a UIImageView added to a myTableViewCell.nib and declared as IBOutlet. In IB I set the properties to set the content mode to "ScaleToFill".
The images are larger than the UIImageView and I want to auto-scale them down to the size of the view.
Strangely and whatever I try, this doesn't seem to work (XCode version is 3.2.3).
One Oberservation is that the myTableViewCell.myImageView seems to take it's size from the top cell in the tableview, since the cells below are displayed in equal size to the first cell, even though the image sizes are different.
Note that I use the same myTableViewCell in another tableView with different Icons and there it works. I can't spot the difference between the 2 except the jpg files have different dimensions and aspect ratios ...
Is it possible that the TableView-class has something to do with it?
Are the image properties that prevent the image from resizing?
I found th reason for this. In IB the 'Autosizing' parameters were set to strech the image according to the display size.
Changing these parameters to keep the image at constant size resolve the problem.