I have a UIView in which I get certain information about a user, wthin a bunch of textfields and a bunch of photos of him, if available.
No Im a bit limited here, so I must have a UIImage or UIImageView on my View (only the first half of my view, to display this images.
Up to now I have a array of this images in the background and as soon as the user swipe over the UIImageView, the image shows the next.
But it's ugly, becuase there is no real paging (you know, see the second image in pieces while you swipe, at the moment its only a UIMageView.Image = xxx and its ugly) and no zooming (zoom on click).
Any idea to solve this?
Use an UIScrollView and place all of the images in it (as UIImageViews).
Related
I have an UIImageView which covers all of my screen. The pictures that I'm displaying are bigger than it and the .contentmode is set to the.scaleAspectFill So the UImageView is just showing a cropped version of each picture.
In front of them is a CollectionViewController which consists
of multiple pages.
I've used scrollViewWillEndDragging to change my background picture when I move through the pages with a short animation ( each page has a specific background).
Please Help on:
How can I make the background picture move with my touch move horizontally until the scrollViewWillEndDragging happens and move back to its original position if the scrollViewWillEndDragging didn't happen.
Thank you for your time.
First of all, I do not want to create a simple 2 or 3 columns gallery. I need exactly like the screenshot of Photos App, I've attached to the question. Big image can be paginated, thumbnails ill be scrolled, selected image's thumbnail will be animated.
I have some ideas.
1st, I can use collection view for the thumbnail scroller. (I have already done that.) But big images' pagination and animation of the selected images thumbnail is the trick here.
2ns, I can use UIPageViewController for the big image, but how can I achieve the page control with the thumbs, it is the problem.
Any ideas? Thank you.
You can do that observing the scroll view of the thumbnail's UICollectionView. UICollectionViewDelegate inherits from UIScrollViewDelegate, so you can receive notification of the scroll movements.
For every scroll position, check which cell is in the center point of the collection. As soon as that cell changes, you control the UIPageViewController.
I want to create a page with a big image as background and buttons that users can interact with.
So imagine I put a big image such as a piece of map into the screen, but I only show a corner of the map in the display. So if a user wants to see other parts of the map, they have to "scroll" and navigate to wherever they want.
Meanwhile I also want to put a button they can tap on, and that button should lead to a php webpage (in-app, not opening in safari or else) or information page about sites and buildings in this location.
I am a rookie and I haven't have any code written down yet. I am thinking about using UIScrollView and UIButton, but am I on the right direction? Any advice?
Thanks in advance!
First you need a way to pinch zoom the image. In this mode, you can drag the image in any direction that you want. A common method can be found here. A scroll view can only scroll horizontally or vertically but with that image zooming, each image can be zoomed in and then dragged to any direction you want. You can have a scroll view with only one image.
After you have the image zooming ready, all you need to do is to create a subview on your screen to cover part of the image view or scroll view, whatever you used.
I have a UITableView with rows.
Each row has a small UIImageView aligned to the right (a "bookmark" icon)
The UIimageView has a UITapGestureRecognizer associated.
cell.favoritedImageView.userInteractionEnabled = true
cell.favoritedImageView.addGestureRecognizer(gestureRecognizer)
The problem is that to actually tap it with the finger (in a real device), you have to use the tip of the finger and be very accurate, because the image is small.
If you miss tapping the imageView, the cell is tapped (didSelectRowAtIndexPath) and you end up executing a show-segue to another view, so you have to go back and try again (not cool)
Question: what is the best way to solve this? I want it to be easy to be tapped.
I have some ideas:
Create a larger image with transparent surrounding (ie: crop out with transparent background) -- downside is that I also use this image in other views, in which is not tappable, so I'd have to create two versions of the image
Put the image inside a UIView and make the UIView big and tappable instead of the UIImageView
Add padding to the UIImageView (will this work? or the padding is not recognized in the UITapGestureRecognizer?)
Per your own suggestion, you should create a transparent view that is much larger and attach the UITapGestureRecognizer to the view and then nest your smaller image within the view. That way appearances are the same, but you handle a much larger area for the tap to be recognized with selecting the cell.
Let's say I have a complex UIView, which is initially on the screen with quite small frame, let's say 80x80.
One of its subviews is an UIImageView displaying an image whose actual resolution is 1024x1024.
When the user tap the UIView i want the view to zoom in almost full screen so that the user can better see the image.
I know already how to scale a UIView to zoom in, my question is the following.
What's the best way to zoom in this view without pixellating the image?
I thought of these options:
I can actually set the frame of the UIView to the full screen size, and normally scale it down, so I'm sure that when it's zoomed in, it will be perfectly detailed. This solution anyway have a strong performance issue, cause moving around many of these scaled down views, will be quite an hit on the CPU/GPU.
I can do it just as I described, so small frame and scale > 1 to zoom in, but in this case will the image be displayed without pixellating?
I can actually set the frame to redisplay the view at the big/small size. In this case the detail will be good, but I have a performance hit here too, because my UIView have around 15 subviews that need complex calculation to relayout, so it's not so "fast" to set the frame.
Which is the best solution? Or do anybody have any other better solution?
Why dont you just have thumbnail representations that are 80x80, and when the user taps on any thumbnail, you transition from your current view containing all the thumbnails to a new view with the +transitionFromView:toView:duration:options:completion: method and simply display a UIImageView with the full resolution image loaded into that new view :)