ios - Horizontally Center UILabel + UIImageView inside UIView with Autolayout -


first problem:

i have uiview contains uilabel (dynamic text) + uiimage. want them centered inside uiview. these images:

enter image description here

enter image description here

the answer here out of date , have stack view maybe can make task easier.

second problem:

i have 3 uiview's next each other each 1 has uiimageview + uilabel should centered in container (problem 1). in iphone 4s has small width screen text breaks layout, in image :

enter image description here

i use xcode 7.0 | target ios8 , above | swift 2

this pretty easy in pure autolayout/ib no code. ends looking this: enter image description here

here's storyboard file view can see constraints easily. uses same subview wrapper technique, trick getting labels shrink/cut off needed adding >= 0 constraints both sides of wrapper view, keeping expanding past borders of parent view, in turn keeps label growing.

https://www.dropbox.com/s/ml67zdjwugf8jco/so_solution-20151013.storyboard?dl=0


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -