i have this problem in 2 projects.Normally, profile image is displayed in circle like
and this is ok for iphone5 size.problem raises on bigger devices.like
as you can see size of profile imageview, it looks small compare to cover image.if i let it increase based on outer image then xocde ignores the aspect ratio constrains which results in non cricular profile imageview
here's current constrains image
any suggestion how should i handle it?
Update here's result if i set constrain on profile imageview to increase with ratio to background image.
asks for y of image view,as i want it to be center so i sets fixed hight = 68 in hopes that xcode will break this constrain to keep aspect ratio, result
so if i remove hight = 68 and add constrain like width.
result
A vanilla UIView instance, for example, does not have an intrinsic content size. This means that you need to add four explicit constraints to describe the size and position of a UIView instance in a user interface.
2:3 Aspect Ratio. 2:3 is the most popular aspect ratio for printing. Print sizes that are a 2:3 aspect ratio and are popular with poster, canvas, and decal printing are 24 x 36 inches and 40 x 60 inches.
When you Fit an image, the frame will fit the image, keeping its original aspect ratio. When you Fill an image, the image will crop to fill the frame.
Select your image view and it's super view together and give equal width constraint
,
then select that equal width constraint
from size inspector
, and reduce its multiplier
until you get your desired width!
Now select your image view and give aspect ratio
constraint!
And finally give position constraint for x and y position!
In your case center x
and center y
with it's super view I think!
And your imageview
will increase or decrease with device width and will remains square always!
And You should set dynamic corner radius
(half of width or height of your imageview) in layoutSubviews
method of tableviewcell's class as you need rounded imageview and your size is dynamic!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With