You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hmmmm....I'm studying this framework, and I don't know how to set the yellow view to the view's center (horizontal & vertical) when it's being position(.absolute) mode, could you please give me some solution? 馃槈
import UIKit
import FlexLayout
classViewController:UIViewController{overridefunc viewDidLoad(){
super.viewDidLoad()setupSubviews()}fileprivatefunc setupSubviews(){letimageView=UIImageView()
imageView.backgroundColor =.cyan
letseg=UISegmentedControl(items:["Intro","FlexLayout","PinLayout"])letlabel1=UILabel()
label1.numberOfLines =0
label1.text ="FlexBox Layouting is simple, powerful and fast."letlabel2=UILabel()
label2.numberOfLines =0
label2.text ="FlexLayout syntax is concise and chainable."letlabel3=UILabel()
label3.numberOfLines =0
label3.text ="FlexLayout/yoga is incredibly fast, its even faster than manual layout."
view.flex.padding(10).addItem().direction(.row).define{ flex in
flex.addItem(imageView).width(100).height(80)
flex.addItem().marginLeft(10).shrink(1).define({ flex in
flex.addItem(seg)
flex.addItem(label1).marginTop(15)
flex.addItem(label2).marginTop(15)})}// separator
view.flex.addItem().marginTop(15).height(1).backgroundColor(.lightGray)
view.flex.addItem(label3).marginTop(15)// absolute
view.flex.addItem().size(100).position(.absolute).alignSelf(.center).top(200).backgroundColor(.yellow)}overridefunc viewDidLayoutSubviews(){
super.viewDidLayoutSubviews()
view.flex.layout()}}
The text was updated successfully, but these errors were encountered:
Hmmmm....I'm studying this framework, and I don't know how to set the
yellow
view to theview
's center (horizontal & vertical) when it's beingposition(.absolute)
mode, could you please give me some solution? 馃槈The text was updated successfully, but these errors were encountered: