Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
129 lines (90 loc) · 3.78 KB

File metadata and controls

129 lines (90 loc) · 3.78 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// FBViewController.m
// FBLayout
//
// Created by qiang.shen on 01/03/2017.
// Copyright (c) 2017 qiang.shen. All rights reserved.
//
#import "FBViewController.h"
#import "FlexBoxLayout.h"
#import "FBAsyLayoutTransaction.h"
@interface FBViewController ()
@end
@implementation FBViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIScrollView *contentView = [UIScrollView new];
contentView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-44);
[self.view addSubview:contentView];
UIView *child1 = [UIView new];
child1.backgroundColor = [UIColor blueColor];
[child1 fb_makeLayout:^(FBLayout *layout) {
layout.width.height.equalTo(@100);
}];
UIView *child2 = [UIView new];
child2.backgroundColor = [UIColor greenColor];
[child2 fb_makeLayout:^(FBLayout *layout) {
layout.equalTo(child1);
}];
UILabel *child3 = [UILabel new];
child3.numberOfLines = 0;
child3.backgroundColor = [UIColor yellowColor];
[child3 fb_wrapContent];
[child3 setAttributedText:[[NSAttributedString alloc] initWithString:@"testfdsfdsfdsfdsfdsfdsafdsafdsafasdkkk" attributes:@{NSFontAttributeName :[UIFont systemFontOfSize:18]}] ];
[contentView addSubview:child1];
[contentView addSubview:child2];
[contentView addSubview:child3];
FBLayoutDiv *div1 = [FBLayoutDiv layoutDivWithFlexDirection:FBFlexDirectionColumn
justifyContent:FBJustifySpaceBetween
alignItems:FBAlignCenter
children:@[child1, child2,child3]];
[div1 fb_makeLayout:^(FBLayout *layout) {
layout.margin.equalToEdgeInsets(UIEdgeInsetsMake(20, 0, 0, 0));
layout.width.equalTo(@(150));
}];
UIView *child5 = [UIView new];
child5.backgroundColor = [UIColor blueColor];
[child5 fb_makeLayout:^(FBLayout *layout) {
layout.width.height.equalTo(@(50)).margin.equalToEdgeInsets(UIEdgeInsetsMake(0, 0, 10, 0)).flexGrow.equalTo(@1.0);
}];
UIView *child6 = [UIView new];
child6.backgroundColor = [UIColor greenColor];
[child6 fb_makeLayout:^(FBLayout *layout) {
layout.equalTo(child5);
layout.flexGrow.equalTo(@(2.0));
layout.margin.equalToEdgeInsets(UIEdgeInsetsMake(10, 10, 10, 10));
}];
UIView *child7 = [UIView new];
child7.backgroundColor = [UIColor yellowColor];
[child7 fb_makeLayout:^(FBLayout *layout) {
layout.equalTo(child5);
}];
UIView *child8 = [UIView new];
child8.backgroundColor = [UIColor blackColor];
[child8 fb_makeLayout:^(FBLayout *layout) {
layout.equalTo(child5);
}];
FBLayoutDiv *div2 =[FBLayoutDiv layoutDivWithFlexDirection:FBFlexDirectionColumn
justifyContent:FBJustifySpaceAround
alignItems:FBAlignCenter
children:@[child5,child6,child7,child8]];
[div2 fb_makeLayout:^(FBLayout *layout) {
layout.margin.equalToEdgeInsets(UIEdgeInsetsMake(20, 0, 0, 0));
layout.width.equalTo(@(150));
}];
[contentView addSubview:child5];
[contentView addSubview:child6];
[contentView addSubview:child7];
[contentView addSubview:child8];
FBLayoutDiv *root = [FBLayoutDiv layoutDivWithFlexDirection:FBFlexDirectionRow
justifyContent:FBJustifySpaceAround
alignItems:FBAlignCenter
children:@[div1,div2]];
contentView.fb_contentDiv = root;
[root fb_asyApplyLayoutWithSize:[UIScreen mainScreen].bounds.size];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end
Morty Proxy This is a proxified and sanitized view of the page, visit original site.