How to edit Swift Desig - user-interface

enter image description here
Why does my bottom row always stretch? Although the opposite is true in the video clip. Namely (it should be 0 on four sides), I have it but the bottom row is stretched
I tried setting it up through safe are top. But still the bottom is stretched. And I don't understand why it does that.

Related

Does UI Automation ScrollPattern have a Bounding Rect or is there a reliable way to get it?

I've been messing around with UI Automation and Scrolling. I found that in notepad if you take the bounding rectangle of the scrollable window, subtract out the size of any scrollbar bounding rectangles, it scrolls perfectly. However, trying the same thing against ISpy++, which aligns the top treeview item perfectly on each scroll even when there may be one or two pixels of the next item in the view at the bottom.
The problem with that is it reports the scroll amount requested was set. Say the view was 6.384914% and you do all the math to calculate where you scroll the view to the next window, say it came out to 24.382102 (completely made up number), so you scroll there, but it really didn't because it aligned the top item which otherwise would be missing a few pixels based on height of window. You read back where scrolling decided to set it and it says it was 24.382102 (note that when the scroll actually moves a full item it does report a different final scroll position and so can be calculated out).
What would solve the above is if we knew the actual bounding rectangle of the view that represents the 6.384914% so that those extra pixels wouldn't be considered part of the view, when you move to the next page, you're now align to where the next page would actually start. In this case of the tree, the bounding rectangle would be aligned to all items that fit plus the final spacing (or that could be part of the top of the view).
I wanted to scroll and get the data perfectly without any overlaps (except on final page of course, but that could be calculated out when you have the proper aligned boundaries that matches scrolling) or extra spacing.
Is there a way to do that, that I'm missing?
TIA!!

AspectFill - clip only one side

I would like only the bottom part of the image to get clipped, is that possible? Currently, equal portions of the image get clipped at the top and at the bottom.
I tried setting VerticalOptions to Start, but had no success.
The red rectangles represent the screen and the blue rectangles represent the image that needs clipping. The top figure shows the current state and the bottom figure the desired state.

Achieve pixel perfect on Canvas?

I want to make exact 1-pixel thick line without distortions. (means not appeared as 2-pixel lines or 1.5-pixel lines, etc) Because it seems like the Canvas just can't stand Pixel Perfect at times.
It is also depends on CanvasScaler setting, make sure that screen/canvas output is exactly at scale 1x.
Confirm that canvas final scale is all 1x
Also confirm that your displaying game window has 1x scale so that 1 pixel show up nicely too!
(View full unscaled image in another window if sprite in above image appear jagged)
For canvas scaler setting, if you use it in other mode such as "Scale with screen size", and its reference resolution did not match current game window, it will result in non 1x scaling.
If scale is non uniform, jagged or blurry line will start to appear on canvas.
Notice the middle sword sprite.
Canvas' pixel perfect tick box helped nothing so far.
Actually, sorry. Canvases try to respect screen pixels when scaling with PixelPerfect set to true.
The solution was pretty easy - just setting PixelPerfect to false. I got so used to set it to true (because of the UI style I was going for before) that I didn't even consider turning it off. I guess that's mainly due to its name - Pixel Perfect.
xD

Xcode 8 Auto Layout Constraints not working as expected. Very basic setup with centering plus an issue with pins. Video attached

I am having trouble getting a grasp on how auto-layout constraints work. In theory, one should be able to add a label to the storyboard, then assign a horizontal centre constraint and it should be centred on all devices, correct? However, when I do that, it does NOT stay centred UNLESS I also add a vertical spacing constraint. However, if I test the app it IS centred (without the vertical spacing constraint). This is causing me great confusion.
Secondly, if I add a text input, expand it to full width, then add pin the left and right side, it does NOT maintain the pins in other views. And instead there is this dotted box inside a solid orange line box which is centred, but the element itself is not.
I am at a loss please help. I have attached a video of me doing it in Xcode. Both issues are in there First the centring issue, next to the pinning issue. Thank you!
VIDEO OF THE ISSUES HERE:
https://vid.me/XxFo
-- Red lines mean Constraints are ambiguous. Yellow means warning, Its show you the runtime demonstration of view.
View need four constraint to satisfy its full position.
x, y, width and height
When you give only center horizontally constraint, this is not enough you have to specify the y position as well. Label get its width and height from its text length and text font size.
Though constraints are ambiguous and in preview you are not getting correct result but once you give center constraint, it will be center at runtime.
Run the app and it should be in center horizontally.

Cocoa Resolution Independent Button Graphic

I'm trying to create a graphic in Sketch (a vector-based graphic design application). I export to PDF and this is what my original graphic looks like:
But when I set it as the image of an NSButton, it gets drawn like this:
Why does this occur? The right and bottom edges in particular are altered a lot. I'm not sure if this is a Cocoa drawing issue or an issue with my original graphic.
The problem is with (mis)alignment with the pixel grid and anti-aliasing. It looks like you've scaled the image so that the borders on the left, right, and bottom are roughly one pixel in thickness. However, the right and bottom borders are straddling the boundary between pixels. The result is that they contribute half their "darkness" to the pixel on one side of the boundary and the other half to the pixel on the other side of the boundary.
You should tweak either the proportions of the image or the size at which you're drawing it to avoid that particular alignment. It looks as though it's being rendered as roughly 10.5 pixels wide. You want it to be either 10 pixels or 11 pixels wide, so the right edge corresponds more closely to a pixel column.

Resources