2 UIScrollView detect current page and loading correct ppage - iphone

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.

Related

Scrolling whole Image from UICollectionView

I have a UICollectionView with UIImage and when i tap on the Cell it´s comes a whole UIImage. I want to Slider Right or Left on the whole Image then show the next UIImage from the UICollectionView like a Photo Gallery. How can i make that ? Thanks for Help.
UICollectionView and Whole UIImage
You could use a UIScrollView for that, large enough to carry 3 images, the current one, the previous one and the next one. The largest is in the middle. The scrollview scrolls horizontally. Then you react on scrolling (and gestures) and when the user scrolls to right or left then you scroll your scrollview to the middle again and realign the 3 images by discarding one and adding a new one dependig on the direction the user scrolled.

moving across an image-that larger than screen size

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.

iPhone - scrolling a UISCrollview to keep objects moving

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.

How can i move images on touch event?

I have created a image gallery. I show all images from plist file in navigation view. When i open image in full view after that i have to back in navigation. But i want to move images in scrolling when image in fullview. After open image in full view i want to swap one by one next as well as previous...
Is there possible..??
Plz give me help about any kind..
Regards....
Yes thats possible, make your fullview a scrollview with its contentsize having the same width as your screen and its height being the combined height of its subviews (put at least two or 3 imageviews in the scrollview as subviews). You can add and remove UIImageviews as subviews of the uiscrollview as the user vertically pages through them. You will need to communicate with the navigation view what the table status is when your user returns to that view though so that everything matches up.

Scrollview and image dragging issue

I have a scrollview that has a number of custom imageviews in it. I use the custom imageviews as I need to be able to drag any one of them off the scrollview and to another location on the iPad screen, bit like a photo picker.
Problem is if I want to scroll the scroll view most of the time the custom imageview gets the touch and moves rather than the desired scroll?
I notice in the sample code from Apple using the autoscroll example that they have the same issue but they have left a large gap between the images....ugly!
Is there a way to let the app know when you want the touch to be a scroll and when to be a drag?
Thanks
You could make a drag require holding for 1 second, similar to the behavior of the home screen when in editing mode: if you want to scroll, you just flick; if you want to drag, hold down for a moment until the icon enlarges, then you can move it.