I have a problem that I have two lobbies,
1) will be a longer text 2) This will be just another button (link)
So I want that when the first lesson ends, the second label starts right from where it ends. But the problem is that there is text variables, so I could not find any way to make it dynamic. Example
The text of the first line is "This is the text of the first label" "more"
The second line of text "best test" "more" "
Example line rows are in table view and two tables are separated "So I should start another label from where the first label ends
Curiosity for some solution
Thanks & amp; ;; Regards
You may need to add some assumptions in cases, when the first text label is also due to the length of the screen etc., but this code should work normally. NSString is used when using some methods to calculate its size You can use it to determine the text width and to place your more buttons according to the given font (such as
CGFloat firstLabelWidth = [firstLabel.text sizeWithFont: firstLabel.font] .width; CGFloat moreX = firstLabel.frame.origin.x + firstLabelWidth + someGap; MoreButton.frame = CGRectMake (moreX, more, someWidth, someHyight);
Comments
Post a Comment