Skip to content

Commit 07be46d

Browse files
committed
update objective_c.md
1 parent 60b59ef commit 07be46d

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

Example/PinLayoutSample/UI/Examples/IntroObjectiveC/IntroObjectiveCView.m

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,10 @@ - (void) layoutSubviews {
6868
CGFloat margin = 10;
6969
UIEdgeInsets safeArea = self.pinObjc.safeArea;
7070

71-
logo.pinObjc
72-
.topInsets(safeArea)
73-
.leftInsets(safeArea)
74-
.width(100).aspectRatio()
75-
.margin(margin).layout();
76-
segmented.pinObjc
77-
.rightOfAligned(logo, VerticalAlignTop)
78-
.rightInsets(safeArea)
79-
.marginHorizontal(margin).layout();
80-
textLabel.pinObjc
81-
.belowOfAligned(segmented, HorizontalAlignLeft)
82-
.widthOf(segmented)
83-
.pinEdges()
84-
.marginTop(margin)
85-
.sizeToFitType(FitWidth).layout();
86-
separatorView.pinObjc
87-
.belowOfViewsAligned(@[logo, textLabel], HorizontalAlignLeft)
88-
.rightToEdge(segmented.edge.right)
89-
.height(1)
90-
.marginTop(margin).layout();
71+
logo.pinObjc.topInsets(safeArea).leftInsets(safeArea).width(100).aspectRatio().margin(margin).layout();
72+
segmented.pinObjc.rightOfAligned(logo, VerticalAlignTop).rightInsets(safeArea).marginHorizontal(margin).layout();
73+
textLabel.pinObjc.belowOfAligned(segmented, HorizontalAlignLeft).widthOf(segmented).pinEdges().marginTop(margin).sizeToFitType(FitWidth).layout();
74+
separatorView.pinObjc.belowOfViewsAligned(@[logo, textLabel], HorizontalAlignLeft).rightToEdge(segmented.edge.right).height(1).marginTop(margin).layout();
9175
}
9276

9377
- (void) setLayoutGuidesTop:(CGFloat)top {

docs/objective_c.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ This example implement the PinLayout's Intro example using objective-c
1414
```
1515
- (void) layoutSubviews {
1616
[super layoutSubviews];
17-
18-
[[[[[[logo.pinObjc top] left] width:100] aspectRatio] marginWithTop:topLayoutGuide + 10 horizontal:10 bottom:10] layout];
19-
[[[[segmented.pinObjc rightOf:logo aligned:VerticalAlignTop] right] marginHorizontal:10] layout];
20-
[[[[[[textLabel.pinObjc belowOf:segmented aligned:HorizontalAlignLeft] widthOf:segmented] pinEdges] marginTop:10] fitSize] layout];
21-
[[[[[separatorView.pinObjc belowOfViews:@[logo, textLabel] aligned:HorizontalAlignLeft] rightTo:segmented.edge.right] height:1] marginTop:10] layout];
17+
18+
CGFloat margin = 10;
19+
UIEdgeInsets safeArea = self.pinObjc.safeArea;
20+
21+
logo.pinObjc.topInsets(safeArea).leftInsets(safeArea).width(100).aspectRatio().margin(margin).layout();
22+
segmented.pinObjc.rightOfAligned(logo, VerticalAlignTop).rightInsets(safeArea).marginHorizontal(margin).layout();
23+
textLabel.pinObjc.belowOfAligned(segmented, HorizontalAlignLeft).widthOf(segmented).pinEdges().marginTop(margin).sizeToFitType(FitWidth).layout();
24+
separatorView.pinObjc.belowOfViewsAligned(@[logo, textLabel], HorizontalAlignLeft).rightToEdge(segmented.edge.right).height(1).marginTop(margin).layout();
2225
}
2326
2427
```
@@ -31,7 +34,7 @@ This example implement the PinLayout's Intro example using objective-c
3134
The PinLayout's objective-c interface is available using the property `pinObjc` (instead of `pin` in Swift)
3235

3336
```
34-
[[view.pinObjc top] layout];
37+
view.pinObjc.top().layout();
3538
```
3639

3740
#### `layout()`
@@ -47,6 +50,6 @@ When using the Objective-c interface, the `layout` method must be called explici
4750
view.pin.width(100)
4851
4952
// Objective-c
50-
[[view.pinObjc width:100] layout];
53+
view.pinObjc.width().layout();
5154
```
5255

0 commit comments

Comments
 (0)