UIScrollView with two overlapping UIImageView - ios

I'm new to objective-c and iOS development.
I need an iPad application to display some images and designs (draw) over its, but the design needs be done in a separate image. My idea is use two overlapping UIImageViews, the first one is the images that I want to see, and the second one is an image with transparent background where I will draw some things with finger. All of this is OK and i have implemented, but I need that the zoom be enabled to tow images in the same time. When I'm zooming, the tow images need be resized at the same time.
The scroll needs to work to the images at the same time too.
How can I do this?
Somebody help me!

The two UIImageViews you are overlapping should be subviews of the same UIView.
Then, apply scrolling and zooming to the base UIView, and it will affect also the subviews.
If you haven't added the two UIImageViews to a UIView, then you can do that like this:
[view addSubview:imageView1];
[view addSubview:imageView2];

Related

UIcollectionView Custom Shape Objective C

I have a UIView then I put small UIImageViews with an image but I would like to replace this with a UICollectionView. I am not sure how to make the cells go in a upside down U shape like this.
Any help would be appreciated.
This is what UICollectionView is for, however, this is an advanced subclass of UICollectionViewFlowLayout
and really not something to "ask" for a solution here on SO, however, Google and you will find some tutorials regarding custom layouts, for example.
If you have no dynamic updates or movement of the UIImageViews, and they will always be visible on the UI (not move out of the screen) you really don't need a UICollectionView for this, but rather a customized UIView with your custom UIImageViews on it.
You could do this in a XIB subclassed UIView and with AutoLayout for example. (You can still customize it to dynamically update and move of course if needed)
Sidenote:
If the UIImages loaded into the UIImageViews are big sized, they will soak your memory and you will probably run into memory problems, make sure your UIImage are thumbnails and according to the displayed UIView size.

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.

iOS - Isometric grid image problems

I have a myriad of UIImageViews that act as 'tiles' on a map. They align up next to one another to form a grid of images. The layer of each UIImageView is added as a sublayer of a UIView.
Ordinarily, the grid images are flush against each other, but whenever the UIScrollView that contains the UIView is zoomed in or out, the spaces between the tile images become visible, showing off the grid pattern that I'd like to be invisible.
Any ideas what might be causing this?
Sounds like you're trying to create a CATiledLayer from scratch...?
Why not just use CATiledLayer?

iOS - UIImageView slight glitch

I have a myriad of UIImageViews that act as 'tiles' on a map. They align up next to one another to form a grid of images.
Ordinarily, the grid images are flush against each other, but whenever the iPhone or iPad device is rotated, or if a UIView is applied to the view that contains these tiles, the spaces between the UIImageViews become momentarily visible, showing off the grid pattern that I'd like to be invisible.
Any ideas what might be causing this?
Thanks
Consider using CATiledLayer to draw all the images in a single view instead of using multiple subviews. There's a nice writeup on using it at Cocoa Is My Girlfriend. CATiledLayer makes it easy to build an image out of smaller tiles, display higher resolution images as the user zooms in, and avoid memory problems that come from keeping too much of a large image loaded.
this is happening because you are using different views (here uiimageview). Since they are not part of the same fabric during any animation or change in view hierarchy there is a chance that the gap between them would be visible.
This is a very common problem in graphics programming. The way to fix this problem is to have one single view and add these uiimageviews as sub-layers to this view. That way all the imageviews are part of the same fabric and the gap would not be visible.
I did not post any code but then so did you ;)

How to make UIImageView scroll like movie credits?

I want to make Credits in my application, so I make that as an image and I am using UIImageView. I want to make that image scroll up from bottom unseen until all image finish and repeat again infinitely.
I can do that with cocos2d but now I am not using cocos2d and only use UIImageView.
Please share some code...Thanks in advance.
Stick the long image into a UIScrollView and animate its contentOffset. Repeat infinitely. If your image is very large, it might be a good idea to split it into several small ones and insert them consecutively.

Resources