This question already has an answer here:
Changing text in a UILabel is causing all my imageViews and buttons to go back to their original locations
(1 answer)
Closed 7 years ago.
I'm trying to move an image across the screen and then interacting with a text field. I programmed a buttton that defines what the position of the image is, randomly. Now, if I try to change the text in the text field, the image automatically moves back to its predetermined place. I want to know why this is happening and how can I fix it.
Now, if I try to change the text in the text field, the image automatically moves back to its predetermined place. I want to know why this is happening and how can I fix it.
It's because when you change the text, layout is performed, and so everything is positioned according to the auto layout constraints you have applied to it. You never changed the image view's constraints, so it goes back to where you left those constraints.
Related
I'm trying to add a popover on a button but the placement isn't good.
Here is a screenshot :
You can expriment it here : https://stackblitz.com/edit/ngx-translate-example-ruqwa7
I've been able to find the problem but not the solution.
The user clicks on the delete button
Html for the popover is appended in the html. But there is nothing in the body because translations aren't calculated yet (I'm trying to understand why)
a function calculates the required positioning
translations are loaded (too late)
What I noted that was interesting
In the stackblitz, I made en "emulation" without the datatable (with the red square). In this case it works because the translations are loaded before the position calculation is done
Without translation, by hardening the content, there is no positioning problem.
Why is the position calculation done after loading the labels? This is obviously due to the ngx-datatable. Because without the datatable, the position is correct.
The example project is at https://github.com/ivailon/test-008. The issue is that during resizing of the column width while editing cell, the field editor is not resizing correctly. In other words - once I start editing a cell, if I begin resizing the column, the field editor not only resizes incorrectly, but starts to act really strange - in most of the cases the text disappear or it's not possible to see what you are editing.
The example is simple enough .... just try it.
Is there anyone who can at least give an explanation why this is happening?
EDIT:
Problem solved. If someone is interested - the solution is in resizing the container too. I don't know why the container resizes only to smaller size ... maybe a bug in appkit ... maybe I'm missing something.
I am working on one Mac app. In which I want to play few tricks with insertion point of an NSTextView.
![NSTextView with overlay on it][2]
What am I doing is, I have an NSTextView (The whole image screen is of NSTextView) and above that I have placed one overlay (as you can see at the bottom of the image). There are two Labels at the extreme Left and Right end and has a white gradient view too. All these three I have placed above NSTextView.
Now when User types in, textview gets scrolled and at one point, typed letters goes below the overlay.
I have to manage this stuff only. I want to keep track that user has reached to the overlay border and if yes, I want to move the insertion point to little upside so that user can see the content which he/she is writing.
Will anyone suggest me, how to make this possible ?
I have tried many things, but its not working. Kindly help.
How would I go about setting a custom background image for a UITableView. The wrench in the works is that the table is a grouped style (rounded top corners for the first cell and rounded bottom corners for the last cell). I would like do this as much in code as possible without relying on images too much.
Ideally, here is the solution, but I have no idea if this will work or not:
Create one custom background image
Apply the same custom background image to every cell
Rounding occurs automatically because it is a Grouped table style
Profit.
Is this how it works (besides the profit part... I am an app developer, after all)? Do I need to re-think my approach or is this possible? How would do what I described (or another approach) in code specific to iOS 5+?
Update
Just to clarify a bit, the main question I'm asking is: Does the rounding still occur on the top and bottom cells even if you are using a rectangular image?
Well I think what you are saying is ok, but I suggest creating a unique cell layout in a .nib file and apply there the background. Then, with initWithNibName you can manage every cell at the UITableView's methods on the ViewController.
I wrote simple iOS app which countdown the time til midnight. I have single text label which is used to display current time. I use NStimer to change the content of that label. The problem is that when the content of the label is changed (in every second)the content moves left and right for about 1px. Is it possible the position of label content to be fixed ?
The position of a label is fixed, make sure the text alignment isn't on center.
Why not make sure this never happens by always showing the time in HH:MM:SS format. Something like 01:11:05 etc. Make sure you override the text alignment and the minimumfontsize function to match the current font size