How to slicing image and make it stretchable with image assets - ios

stretch image right and left side
centre arrow remain as it is
i tried with it but centre down arrow position is not properly set by me.

You can't do this with sliced images.
The area between the edges will stretch or repeat in order to fill the area. You can't also preserver the centre section of an image this way.
What you might be better doing is creating a custom drawn view using either CALayer or drawRect.

Related

Trying to clip edges from UIImage to fit to ImageView

I have added an icon to my assets to be used in an image view. However, When I put it in an image view the outer edges seem to be larger than the image itself. Is there any way I can fully fill the image. Even when I try scale to fill or aspect fill, fit options still there remains a margin in between.
In other words I want my circular image to be tangent to the image view rectangle
The example of what I am trying to do

How to ensure a UIView with a transform fills a CGRect?

I have a view UIView that by default has a UIImageView (the blue square in the included image) that is centered in this main view (the gray square in the included image). The main view has an added CALayer that serves as a border (window or mask — the yellow rectangle in included image) through which the image can be seen. The user uses gesture recognizers to pan (translate), pinch (scale), and rotate the image view's transform, but I'd like to give them the option of transforming the image so it completely fills the yellow border (all four corners), much the same way the iOS crop tool does (see attached gif). I've tried to figure out how I can calculate the correct scale factor, but now I'm wondering — is there some simple formula or function that can help me solve this problem?

How to set image in same place when screen resolution change in Unity, ios

I have problem with ui image in canvas, basically when i put image in iphone 5 on top, in ipad that image is out of frame, I didnt write any code only use settings in inspector. how can I do that? By the way iam using Unity 5.5, thanks.
This is probably due to the anchor being not properly positioned.
Your UI item is made of 4 blue points and 4 white arrows. When you positioned the item, each blue dot gets a distance to its matching anchor (top left with top left and so on). You can actually see that distance in the inspector.
Depending on the behaviour you want, you need to set the anchor appropriately.
For instance, if you want the item to be at the top of the canvas, you 'd set the upper anchor at the top of the canvas. The lower anchors would be positioned at the top if you want the size of the item to be constant or at the positioned of the blue dot if you want top rescale based on canvas size.
Best is that you start playing around with the anchor to understand how they work. In the inspector of the RectTransform, there are some predefined anchor and size settings, you can try.

Xcode 5 Image Slicing

I'm trying to slice an image in assets Xcode 5. I don't know if what I'm trying to do is possible with slicing.
The image looks like this:
I need to change the width and the height of the image, although not at the same time. The closest I've got is when I use Horizontal for the height and Vertical for the width. The problem is when I change the width, the left side of the image starts as a straight line and the skews and change to the original shape.
I'm about to give up on the idea of slicing and just create three images, left, center and right. Is that the only way to go?
This is how my current slice looks like:
Is there any way to change it so it works at least for the width?
UPDATE
Instead of slicing the image I used a mask and moved the mask.
Slicing works by taking the center section, and stretching it to fill the required space and then putting on the image end caps.
Because your button has a continuous diagonal line you will not be able to slice it. It will stretch the image out like so:
In fact even if you make a centre section and end caps you will still have the same issue as this image can only be scaled.
If you only need a finite set of heights then you should create individual assets for each height that can be sliced horizontally. If you need N heights then you should look into using core graphics to draw your shape in code in a -drawRect: method for arbitrary dimensions.
P.S. if you want to horizontally slice so you can grow the width its most optimal to have only 1 pixel width of image that will be stretched out so your button image resources would look a bit like this:
Aha. TIL: You can change the slicing options from the attributes inspector in the right hand pane in Xcode. To make your slicing work choose only "Horizontal"

iOS swipe filters over static image

I'm looking for a way to swipe image filters over top of a still image.
Mainly the base image stays in place, and the filters slide in over top when you swipe left or right.
Right now I have a base UIImageView and a Collection View over top of it which in theory would hold the filters (texture and gradient images).
I've read that UIImageViews and UIViews can't be live composited on top of each other, and that you must make the image before displaying it. So I can pre-make the image beforehand in code, then can I wipe-reveal the filter image to get the same effect? Using masks?
Code examples are nice, but a high level description on how to approach this would be helpful.
The app Spark has this functionality for videos, I'm looking to do something similar for photos.
So I can pre-make the image beforehand in code, then can I wipe-reveal the filter image to get the same effect? Using masks?
Yes, but no need for a mask. Pre-make the filtered image and put it in an image view. Let's say this filtered effect is to be swiped in from the left. Then make the image view's content mode be Left, and put it at the left of the real image, with width zero. As the swipe happens, animate the width of the image view to the width of the image. This will cause the filtered image to be revealed from the left side.

Resources