UILabel sizing during device rotation - animation

In my app I have two labels. Second one should be positioned below the first one (with some small const padding). The first label is multi-lined and takes all possible width. So after changing interface orientation, its real height can change (because necessary line number can change). That's why autoresizing mask can't help me here.
So.. How can I control this and display labels correctly even during interface orientation change animation?

Damn. I'm so sorry about this question. I've really googled before asking and tried to read docs. But somehow I've missed this and this with great details about my question.

Related

Three.js - Add image to ExtrudeBufferGeometry

I want to add an image (a factory layout displayed on the floor) to an ExtrudeBufferGeometry (the floor) which is based on a shape with holes. I only want to cover the surface and not have it wrap around the corners - is that possible? If not, I am fine with a 2D geometry/plane as well as long as I can still punch in some holes.
I have successfully added said image to a PlaneGeometry but that does not allow for any holes.
I also managed to add it to the ExtrudeBufferGeometry but it looks like it only covers the border area as you can see colors when viewing it from the side. If I set the texture's repeat value using texture.repeat.set(), I can see the image properly. However, I do not want it to be repeated. It should only be displayed once. I'm having a hard time knowing what properties to set and change to achieve the desired result.
I researched a lot to get to this point but I cannot find a final solution for my specific problem. Any help or suggestions are highly appreciated - thank you!
Edit:
I managed to do it using ShapeGeometry. However, I still need texture.repeat.set(), otherwise it will be a tiny image on one side. Can anyone tell me how to adjust the scale?

how to use texture masks in game Maker?

First off I'm not totally sure if "texture masks" is the correct term to use here so If someone knows what it is then please let me know.
so the real question. I want to have an object in GameMaker: Studio which as it moves around it's texture changes depending on its position by pulling from a larger static image behind it. I've made a quick gif of what it might look like.
It can be found here
Another image that might help explain this is the "source-in" section of this image.
This is a reply to the same question posted on the steam GML forum by MrDave:
The feature you are looking for is draw_set_blend_mode(bm_subtract)
Basically you will have to draw everything onto a surface and then using the code above you switch the draw mode to bm_subtract. What this will do is rather than drawing images to the screen it will remove them. So you now draw blocks over the background and this will remove that area. Then you can draw everything you just put on the surface onto the screen.
(Remember to reset the draw mode and the surface target after. )
Its hard to get your head around the first time, but actually it isn’t all that complex once you get used to it.

How to measure space between lines of text drawn on screen?

We have an end-user application that allows you to write multiple lines of text into a text box, it persists this information to a text file. Upon the next session that information is retrieved from the file to display the text. The problem is sometimes on the next session the bounds of the text box are cutting of the text so the user is having to manually resize the textbox. I'd like to programmatically figure out if the text box needs to be resized.
GetTextExtentPoint32() seems to work well for measuring the actual drawn width of the line based on the current font selected into the Device Context. However now I'm tackling the need to resize the textbox bounds in the vertical direction. GetTextExtentPoint32() does give me the height, which seems correct, but the total height I get is a bit too small. I believe I need to measure the space between each line, but I'm not quite sure?
Update: It looks like I'm looking for TEXTMETRIC.tmExternalLeading and TEXTMETRIC.tmInternalLeading. What's interesting is for some fonts and sizes, the calculation is spot on and I can fit my text perfectly. But for some fonts and sizes, the calculation is a bit too small, in that case it seems the leading is too small or 0?
As long as I remember you can use GetTextMetrics function and (Metrics.tmAscent + Metrics.tmDescent) should be the value you're looking for

Visual Format Language - padding area

I have several objects that are static in size that hug the top and bottom of the screen. However, there is a blank area in the middle of the screen that I would like to stretch with orientation change.
I have solved an issue by adding an extra clear view [paddedView] that can be stretched but wanted to know if there was an easier way to do this without the paddedView just with Visual Format Language.
#"V:|-20-[topLabel(40)]-15-[anotherTopLabel(40)]-[paddedView]-[bottomView(73)]|";
Instead of a view used only for padding, you can either specify a lower priority to a distance or specify the constraint as "greater than or equal to".
Since what you want is a flexible space, the last option sounds like the best one:
#"V:|-20-[topLabel(40)]-15-[anotherTopLabel(40)]-(>=15)-[bottomView(73)]|"
The number 15 is of course just an example.

Crazy Font Issue with NSTextView

I'm knee deep in font metrics with NSTextView at the moment. I was hoping a developer here could shed some light as to what's going on.
With Myriad Pro in a default NSTextView (dragged from IB and run in a fresh project), here's what you get:
Notice how the selected rect has the same height as the insertion point.
Now for behavior from Pages:
Notice how the selected rect is similar to the regular text view version, but the insertion point height is actually more reflective of the font (and smaller!).
Weird.
Why do I care? Here is a screen of my application with Helvetica, and then with Myriad:
Notice that in both cases, the outline symbol is perfectly centered with the insertion point height. Those symbols are actually subviews, and not in the text stream. Notice those symbols in Pages. They remain centered for Myriad. Clearly Apple realized something and fixed it. Any ideas what they did?
Thanks!
This isn't a mistake on Apple's part but rather an assumption on yours. This is a function of font metrics as well as line height.The insertion point takes the whole line height; the drawn font parts don't.
I thought it was you who I pointed to the Font Handling guide a few days ago. Either way, you need to understand this topic thoroughly so you can determine where to draw your dot.

Resources