I was asked in our company to take an image that is larger than iphone screen size, and it has to be a background screen, and move (horizon) . so user see an image that moves from right to left by it self as a moving background.
i will be happy for any information on how to do that with xcode only .
i think i know how to animate images, but this shuld be bigger that screen size and move across one wide image as a camera ..
Use a UIScrollView and add the image view as a subview of the scrollView.
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 want to accomplish this:
Load a UIViewController with a image in some part of it. The image should be a little smaller than the original and also cropped in top and botton and when touch on it to animate into full screen.
Something like JetSetter app does
I have a UISCrollview. Inside this scroller I have a picture and over the picture I have some objects (as subviews of the picture), like layers in a Photoshop composition. So, if I zoom the picture, the objects will zoom. If I scroll the picture, the objects scroll.
Now consider this: I have the picture zoomed in. The picture is now larger than the iPad screen. I am seeing the top half of the picture. I touch an object that is over the picture and start dragging it to the bottom of the screen. My intent is to drop the dragged object at the bottom of the picture, but as the picture is zoomed in, I have to drag the element to bottom of the screen, release it, scroll the picture up and then continue dragging the object.
What I want is this: I start dragging and when I arrive at the boundary of the screen, the scroller starts scrolling automatically showing parts of the image that were down or up.
What do I need is to know the rect that is visible, a kind of inverse of scrollRectToVisible...
Considering that the picture can be zoomed at any level, how do I know if the element I am dragging is near the border. BTW, how do I know what part of the scroller is being shown, even if it is zoomed?
thanks.
The visible rectangle has a size of scrollView.bounds.size and an origin of scrollView.contentOffset, in the coordinate space of the scrollview. Depending on what exactly you are doing, you may need to use convertRect:fromView: or convertRect:toView: to convert it into the coordinate space of the zoomed view.
In my App I have a full-screen UIScrollView where the content is a UIImageView containing a map image which is about 2000px square (i.e. larger than the UIScrollView).
Currently, I plot a path across the map and animate a "beacon" image along it using a CAKeyFrameAnimation, which works great.
What I would like to be able to do is to make the UIScrollView content move with the animation in such a way as to keep the beacon image in the centre of the screen (giving the user the impression of tracking along the path).
Any suggestions on how I might achieve this?
First part of the question: Detecting current images being displayed in scrollview A and B
i want to place two UIScrollViews in my main view. Very simply done. So ive placed UIScrollView A above UIScrollView B.
so it looks like this:
Graphical representation
________
| A | ScrollViewA is above ScrollViewB
|______|
| B | ScrollViewB is below ScrollViewA
|______|
There will be images which the user can flick through left and right on both ScrollViews.
They both show different set of images.
First i want to know how to detect which image the both scrollviews are on. for both A and B.
so i should be able to detect which images are being displayed on scrollviewA and scrollview B
eg: UIScrollView A is on image 12 and UIScrollView B is on image 67.
Second part of the question: Loading images on both scroll view as user scrolls from left and right
Because there will be many images in ScrollViewA that the user can scroll from left to and right; and many images in ScrollViewB that the user can also scroll from left to right; obviously i dont want to load them all into the scroll view. Whats the best way i can load them in a scrollview?
an idea is if a user is on image 5, then the user flicks to the left, then the next image will be 6 so only load that image. and so on.
Can everyone help me on how to implement such a thing. Thank you.
All your ideas and help will be appreciated.
On loading images, you can do this:
Load current image
Buffer load next and previous images and position them outside the bounds of the visible view
When user flicks left, move right image into view, unload the left image and buffer a new right image. Do the same thing for the right one.
This way you will only have 3 loaded at a time for a scrollview.
On keeping track of which image is loaded, you have to keep track of that yourself.