File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed
MDLayoutSample/MDLayoutSample Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1
1
2
2
Pods /
3
3
Podfile.lock
4
+
5
+ MDLayout.xcworkspace /xcuserdata /jayden.xcuserdatad /UserInterfaceState.xcuserstate
Original file line number Diff line number Diff line change @@ -57,10 +57,16 @@ +(UIView *)loadViewWithXMLElement:(RXMLElement *)element styleSheet:(MDStyleshee
57
57
NSArray *names = e.attributeNames ;
58
58
NSString *viewId = [e attribute: @" id" ];
59
59
60
- // 应用样式
60
+ // 应用类样式
61
+ MDStyle *style = styleSheet.targetStyleSheet [ename];
62
+ if (style) {
63
+ [currentView applyStyle: style];
64
+ }
65
+
66
+ // 应用指定样式
61
67
NSString *styleName= [e attribute: @" style" ];
62
68
if (styleName) {
63
- MDStyle * style = styleSheet.styleSheet [styleName];
69
+ style = styleSheet.styleSheet [styleName];
64
70
if (style) {
65
71
[currentView applyStyle: style];
66
72
}
Original file line number Diff line number Diff line change 1
- <View >
1
+ <Page >
2
2
<Resources >
3
3
<Stylesheet ref =" styleRef.xml" >
4
4
<Style name =" pageStyle" >
5
5
<Setter property =" backgroundColor" value =" #7F7F7F" />
6
6
</Style >
7
+ <Style name =" textStyle" target =" UILabel" >
8
+ <Setter property =" textColor" value =" #4455ff" />
9
+ </Style >
10
+
7
11
<Style name =" textHeaderStyle" target =" " >
8
- <Setter property =" textColor" value =" #000000 " />
12
+ <Setter property =" textColor" value =" black " />
9
13
<Setter property =" backgroundColor" value =" green" />
10
14
<Setter property =" font" value =" SegoeUI-Bold 20" />
11
15
</Style >
12
16
<Style name =" buttonStyle" >
13
- <Setter property =" titleforNormalState" value =" on my g " />
17
+ <Setter property =" titleforNormalState" value =" on my god " />
14
18
<Setter property =" titleforSelectedState" value =" click me" />
15
19
<Setter property =" selected" value =" YES" />
16
20
<Setter property =" layer.cornerRadius" value =" 2" />
41
45
<Constraint attribute =" right" target =" containner" relation =" =" constant =" -10" id =" right" />
42
46
</Constraints >
43
47
</UILabel >
44
- <UIButton id =" centerButton" mdoutlet =" YES" buttonType = " UIButtonTypeCustom " clickAction =" centerButton_click:" style =" buttonStyle" >
48
+ <UIButton id =" centerButton" mdoutlet =" YES" clickAction =" centerButton_click:" style =" buttonStyle" >
45
49
<Constraints >
46
50
<Constraint attribute =" width" relation =" =" target =" containner" targetAttribute =" width" multipliedBy =" 0.8" id =" width" />
47
51
<Constraint attribute =" height" relation =" =" constant =" 200" id =" height" />
57
61
</UILabel >
58
62
</DemoHostView >
59
63
</Layout >
60
- </View >
64
+ </Page >
Original file line number Diff line number Diff line change 3
3
<Style name =" bottomLableStyle" >
4
4
<Setter property =" textColor" value =" red" />
5
5
<Setter property =" font" value =" SegoeUI-Bold 25" />
6
- <Setter property =" backgroundColor" value =" yellow" />
6
+ <Setter property =" backgroundColor" value =" yellow" />
7
7
</Style >
8
8
</Stylesheet >
You can’t perform that action at this time.
0 commit comments