Image Positioning when resizing - ios

I have an image that is 1000x134 referred to as logo
I have an UIImageView that contains that logo as AspectFit
I have another view in the back
The user is allowed to pan, pinch, and rotate the logo to position it where ever they want on top of the background view
After they have positioned the logo, I then increase the size of the background view
Problem: After the background view's size gets increased, the position of the logo gets messed up.
Question: How do I scale the logo with the background view in order for it to appear in the same position?

You should make the UIImageView a subview of your background view. That would make it easy to resize the whole view, perhaps using self.view.transform.

Related

Setting background of view to an image that is able to pinch zoom

I have created a game where a map is on the screen. With this map I would like to have buttons to change scenes and preform actions. The map I have on the screen I would like to be the full screen with pinch zoom capability, along with capability of a button or label to be on top of the image, without the button being zoomed in on or below the scroll view. I tried using a UIScroll View but the button kept zooming in and going below the image. How can I set the background of my View to a pinch zoomable image with labels and buttons on top not being effected in swift and xcode 7?
I am not sure if this is the most efficient way, but by calling the method touchesDidBegin() you can move the objects like the TextField and the buttons to a new view that is above the scrollview. Then when touchesDidEnd() you can move them back into the scrollview.

UIScrollView with a background set to the blurred image

I have a UIScrollView that shows certain images based on an index. When an image loads, I want to set the background of the UIScrollView to the blurred version of that image.
Right now I have a container view that houses the scrollView, and I've been trying to add a blurred subView to the container but it's not working out. If I just add the subview it gets rendered over the scrollView which id obviously no good, and If I add the subView and send it to back then I don't see any blurred effect at all.
Is this the right approach or is there a better way to achieve the effect I'm going for?
As you said "and If I add the subview and send it to back then I don't see any blurred effect at all."
To sort it out, You may try changing the background color of Scrollview to clearColor.

set iOS bg images all screen sizes

I have created background images for all iOS devices. As far as I understand, iOS will pick the appropriate image at runtime according to screen resolutions.
Is there a way to set the image as a screen background for the root view? The method should take automatic image picking into account.
Is there a way to set the image as a screen background for the root view
In the storyboard, locate the scene representing the root view controller and its view. Drag a UIImageView into the main view and pin its top, left, bottom, and right to the edges of its superview with a constant of zero. Send it to the back so that it's behind all other subviews of the main view. Set its image to the desired image, and supply an appropriate content mode. Done.

Autolayout position reset

I have a View and i have a an image view inside it and a another UiView and one or two more view in side the top level view. The problem is when i run my app in different screens iphone the image view resizes and i want the other view to change the their position to a little bit down. But only image view gets more space, but i don't want the other view to get more space but i want them to change their position.
Here i want the white view the Placeholder text and the the small picture view to change their position and go a bit down when the app runs on big screen iphone. Th rounded image view above the Mybutton gets more space when the screen resizes which is okay but the white view and other view remain at their same place. Just to add more information all these view are siblings of each other and i have fixed the the width and height of the white view, picture view and the placeholder text label
Any guidance please?
I think you have to start with the "movable" element and then add every "fixed" element.
I think you have to work with Center Y Alignment Contraint even if you have to create new view for it. The beginning could be :

Show "Black" when you "Scroll" down image

I have a pretty simple scroll view (code below) which i have a picture on
self.detailViewController.scroll.contentSize=CGSizeMake(320, 1200);
self.detailViewController.scroll.showsHorizontalScrollIndicator=YES;
However when i "Scroll to the extreme button or extreme top of the picture or extreme button of the "scroll view, it loops and shows the top of the picture or loops back to the buttom of the picture.
I was wondering if there was some sort of "no repeat" i could set so it shows "black" instead of back to the top of the picture.
Thank you.
colorWithPatternImage tiles the image that it is given. So setting it as the background colour will always result in 'wrap around' if the scroll view can be scrolled outside the edges of the tile image.
To prevent this, choose one of:
Set the content size to the size of the tile image and turn off bouncing
Don't use colorWithPatternImage, use a UIImageView added as a subview of the scroll view.

Resources