What control should I use when doing this in objective-C - ios

Below is my snapshot. In this snapshot I have to make the boot control like images when I click image#1 then image#1 show on the upper side UIImageView I also define on the image... image#1 .. image#1000
so what controls should I use? I think I should use UIScrollView but I don't know what is the height and width I should take for that because UIScrollView has only game of height and width and also how to define click control on them.
I want some slider look like .. I slide the below images.

Yes you will want to use a UIScrollView for this. The width and height will have to be calculated dynamically based off how many images you have and their dimensions.
To perform actions on touches, you will have to either encapsulate each image into a subclass view and handle the touches, or use gesture recognizers.
See this document for more info.

I would use UIButton for the bottom images and UIImageView for the top view.

Related

Horizontal UIScrollView and multiple thumbnail images in iOS?

I need to create a horizontal UIScrollView which to hold hundreds of thumbnail images, just like a slide of thumbnails and a UIImageView that will hold the center image of UIScrollView
For example, there will be 6 thumbnails showing in a single screen, each of them are horizontally adjacent to each other.
My problem is that I don't know how to make a horizontal UIScrollView to hold the multiple thumbnails which showing at the same time and then display the center image to the Topview image?
A sample photo is as below. See the bottom part of the screen.
Screenshot Image
There are many ways, here is one:
The top part
Option 1.1
The top image views can be handled by a UIPageViewController wrapping something to the effect of ImageDetailViewController
Option 1.2
The top is a UICollectionViewController and the large top images are UICollectionViewCells. You can use UICollectionViewFlowLayout with a horizontal scroll direction and pagination true.
The bottom part
Option 2.1
The bottom part should be a UICollectionViewController as you may need to overflow off the screen and it is fast and scrolls horizontally.
Option 2.2
The bottom part can be a StackView created with items programmatically and filled in with a spacing you want. Add a UIGestureRecognizer to detect touch down.
Recommendation
Top: 1.1 - Use a UIPageViewController
Bottom 2.2 - Use a stacked view with a gesture recogniser over the top
Assuming you want them to pan over the bottom, I would say 2.2 is the option, but slightly harder.
So what this looks like is a UIPageViewController, with a floating thumbnail on the bottom to scrub.You can just implement a simple ImageViewer (UIImageView inside a UIScrollView to allow zooming etc).
This will give left/right scroll for free.
You will layout the thumbnails on the bottom inside a stack view and it is better to handle one giant gesture recogniser on the bottom so you can keep it continuous without lifting finger. You will just have to get the coordinates or view that is translated inside the touch.
Rather than go into code because there will be a few different classes I will try to give a topographic explanation.

Custom Page Control with Paging Scrollview

Instead of the standard dots that Apple provides for a page control, I want to have something like this. However I don't want it to be in an infinite loop were you can circle around. All I care about is the scrollable text on top, not the parallax image.
Currently I have a paging scrollview that contains three view controllers so my custom page control will have only three words: Main, Today, Settings.
The way I see this being built is the following:
Subclass UIView and insert three UIButton's and evenly space them. The title of the buttons will be Main, Today, Settings.
Insert this UIView as child of scrollview (or maybe not)
Make UIView the width of the iPhone screen
Not sure about here now -> as you scroll the scrollview shift the UIView on and off the screen so that the UIButton will be centered in one of the view controllers in the scrollview.
Am I on right track or does anyone have a demo to this?
Yes. You are on right track. You can use scrollView for this exact purpose. You have to make use of scrollViewDelegate methods for this. The below link will explain you how to do that.
How to make Paging with scrollView.

Custom UISlider with pips ios

Wondering if the above can be created using UISlider? If not, what other ways can this be accomplished?
You can set components of a UISlider, such as the currentThumbImage ( see: "Appearance of Sliders"1).
However, it is almost certainly easier to just re-implement a slider for this much customization. Simply use background UIImageView with the scale image, and then add a separate UIView (or UIImageView) for the arrow. Finally, attach a UIPanGestureRecognizer to the arrow view to allow a user translate the view vertically.
You can change a lot in the appearance of a UISlider like setting the thumb to a red arrow. You can also replace the background image with the inches ruler and with different rulers for the different device types and display sizes.
The one thing that I don't see is that you turn the slider to work vertically. I know them only working left to right.
If I'm right, your only chance is to have a ruler as background image and a view that contains the arrow and a label with the actual value. That whole view can be pawned and tapped using Gesture Listener.

annotate buttons onto uiimageview (like mkmapview without MapKit)

I have a UIImageView set on top of a scrollView. The image is a map, and I need to annotate buttons across the map to corresponding locations (very specific to the region). The buttons are visible, and they pan and scale accordingly when scrolled/zoomed, this works great. The issue is when the buttons are rendered on different screen sizes, the buttons are placed in different spots since auto-layout puts them the same distance from the edge of the screen, but the image has a different bounds property and is bigger/smaller depending on the device.
I've considered creating an MKMapView with a custom overlay of this image, but I was hoping to keep it super light-weight and avoid MapKit all together.
Any suggestions? Clarifications are fully encouraged :)
You should add buttons as subviews on imageview so that buttons transform in the same way as imageview does.

How to zoom on UIView

In my iOS app I want my users to be able to zoom in on the screen. My main uiview contains several subviews which contain images. I want my uipinchgesturerecognizer to either change the scale, or ideally use some "zoom" rather than scaling each subview.
Please and thank you.
This can be accomplished with UIScrollView. First create a scroll view as the base of your view hierarchy, putting your previous container view as a subview of the scroll view. Set the delegate of the scroll view to self and implement the delegate method viewForZoomingInScrollView, in which you should return the view that will be zoomed in (your original container view). This will allow the user to pinch and zoom your original UIView.
It's hard to provide advice on this without having a clearer view of what exactly you want to achieve.
Can you include a link to a sketch? For example, do you want the individual subviews to remain the same size but the layout to change ? Do you want the individual subviews to resize but their contents to be upscaled?
If you simple want to treat the subview as (basically) a single image which just happens to have other images in it, then maybe it would be better to render it as one and then scale that?

Resources