Strikethrough horizontal line with words in the middle Swift iOS - swift5

I am trying to get this done using AttributedString.
Is there a way to have horizontal line with words in the middle?

you can achieve this by using three label with auto-layout
i give constraint to center label(Today 08.30) center horizontal and center vertical to viewcontroller.
just change the Hugging Priority of center label(Today 08.30) to 1000
now your center label adjust his width accoding to your text.
give backboard color to other two label.

Related

Horizontal Stackview in swift: how to wrap according content

I use a stackview (horizontal) with this setup:
Inside it, I have just 3 buttons (without text, only icon). The height/width button are set by constraints:
And the result is:
BUT I don't understand why my second button has a huge width... even if it width is fixed at 44.
Have you got some explanations guys please?
Thank you very much!
Your settings are just conflicting, that's the answer. It must fill stackview width with 3 buttons 44pt each + 6pt spacing between them, and this can't be resolved, because stackview width is bigger than 44*3 + 6*(3-1).
If you want all buttons be on the left with 6 point spacing, then remove trailing constraint for stackview;
if you want buttons to fill the full width -- then remove spacing = 6 and set distribution = equal spacing
Try to put the distribution to equal spacing on the stack view. That means that the spacing will be equal between every button. If you do not have any constrains on the stack view that affects the width then that should work.
Otherwise you need to increment the spacing value in order for the buttons to have equal widths.
Thanks for the question!

Random table view cell height is not working perfectly

I am designing a chat app in which I am using the UITableViewAutomaticDimension property of table view when I am setting the label lines to 6 then all cells height is according to the text which label contains but when I increase the number of lines for label then some cells have extra height. Even when scrolling it then cell height again changed.You can check the image so that you can understand it easily thanks.
You need to give label constraints from top and bottom, rather than center vertically.
Give vertical content hugging priority

How to get exactly the same point on different screen sizes?

I want to call the action (go to another view) when user tap specific area of image (black dots): . Image fills whole view, content mode is 'Aspect Fit'. The problem is that when I setup it on one screen size (e.g. iPhone 8) on another the 'tap area' is shifted. I've tried to solve this with button and constraints or UITapGestureRecognizer with point conversion using screen resolution (nativeBounds), but nothing helps.
It is possible to use constraints to match the positions of the circles with UIButtons. The trick is to use the multiplier of the constraint to scale the buttons width/height and position to the screen size.
I'll describe how to do it for one button, and then you can repeat it for the others. I assume the image is 657 wide by 918 high. If I have the dimensions reversed, you'll need to substitute the actual values for the ones I have used.
Create a UIView to hold the image and buttons. Give this view an aspect ratio constraint with multiplier 657:918 which is width:height. Add the UIImageView to this view and constrain its 4 edges to the edges of the view with 0 offsets. Give this view constraints to the left and right edges of the main view and give it a vertical constraint to place it on the screen.
Get the width/height of the circle in the image and the horizontal and vertical positions of the right edge and bottom edge. For example, the topmost circle is 106 x 106 and ends at horizontal position 392 and the bottom is at 338.
Set the width of the button equal to the width of the containing view with multiplier 106:657 which is width of circle:width of the image.
Set the height of the button equal to the height of the containing view with multiplier 106:918 which is height of circle:height of the image.
Set the trailing edge of the button equal to the trailing edge of the containing view with multiplier 392:657 which is end of circle:width of image.
Set the bottom edge of the button equal to the bottom edge of the containing view with multiplier 338:918 which is bottom of circle:height of the image.
This will allow the button to stay aligned with the circle on all devices. Repeat steps 2 through 6 for the other circles.
Instead of using an image, you can try creating your own UIView subclass called BlackDotsView.
In the draw(_rect:) method, you can draw the lines. To determine where the lines start and end, you need to do some maths with the view's width and height. You calculate where all the lines end and create UIBezierPaths and then you stroke the paths.
In the initializer of BlackDotsView, you can add the dots as subviews. To make them circular, just set dotView.layer.cornerRadius to half the dot's width. Then, you can add UITapGestureRecognizers to the dot views.
You can follow the delegate pattern by creating a BlackDotsViewDelegate that has a method called dotTapped(index:). When a dot is tapped, you would call the delegate method and pass the index of the dot.

Rotating x axis label to vertical from horizontal in JasperReports Charts

How can I rotate the x-axis label from horizontal to vertical? The words are too long to be placed horizontally, vertically placing them will be able to display them.
Go to chart properties, set it to a numeric value in the properties "label rotation" -45.0 for example.

swift - arrange buttons across many screens

I develop test app with swift ,
I need way to arrange first row in first screen to first row in second screen
to make all button across application look similar
my tries :
match X,Y value , width , height
Do you use Auto Layout ?
You can achieve that by
set vertical space between the top edge and your title
set horizontal alignment of title to be center of the view
set vertical space between title and the first item in the row
set leading margin of the first item in the first row
set horizontal alignment of all following items to be center of the first item