├── 1242x2208@3x.png ├── 640x1136@2x.png ├── 640x960@2x.png ├── 750x1334@2x.png ├── CodeSnippets ├── 026B352A-B671-44FE-BF49-69F0B5E61CA2.codesnippet ├── 09BCBE9D-BD2F-45A2-B1EF-187E64637316.codesnippet ├── 09EA788B-4783-4244-913F-BFC7C493E582.codesnippet ├── 0E0A9D29-5753-4AA4-B937-C81CC4DB8121.codesnippet ├── 0F6658C7-BE25-465B-93A0-2641FA678CEB.codesnippet ├── 1F20C351-4C3F-415E-A290-7CA6AD9F923E.codesnippet ├── 1F5A3E0B-FD9D-46AC-9FBD-1D2B4F20B439.codesnippet ├── 21A02625-1406-484E-A206-8E32D84F80B7.codesnippet ├── 245004AE-6D4D-4137-9BD6-A54E89A3BAA8.codesnippet ├── 259F3024-722C-40D3-A0DE-7C42213B0437.codesnippet ├── 2A573C0E-AD4D-4B53-9B25-A0C688843D37.codesnippet ├── 2E8EB0CD-2BD9-4F4D-B2C2-57429988696B.codesnippet ├── 2FB74FD4-EDB8-430C-92FA-CBE0417866BA.codesnippet ├── 309A4D21-77B4-46C2-98C6-B50C88C05E90.codesnippet ├── 323649BC-DC5F-431B-8064-C0A031C6E5A3.codesnippet ├── 459730D5-7ED1-4DE8-8DE1-4F4700A81AD2.codesnippet ├── 47E93274-F48D-4DBA-9F32-96761282E415.codesnippet ├── 4F0A6E1C-54EF-4FB9-A7B0-B9874163B8B4.codesnippet ├── 5146928C-536E-44E9-9179-99FF560489E8.codesnippet ├── 52C6B421-418D-4ADD-9296-100D8B1E24BD.codesnippet ├── 5860ABF7-5E34-48DD-8F1C-B3E92482D9AA.codesnippet ├── 5A9921AD-B95E-4138-8422-8035B0B3DA6F.codesnippet ├── 5B5C5024-2099-4B1A-B0CB-175D6E0C0177.codesnippet ├── 5C285C83-B9C9-44D0-A7A5-86B6C92F4E7D.codesnippet ├── 5E6F24F7-F960-4E39-AE3F-58AF74245500.codesnippet ├── 5EBA8B27-37C2-4414-A026-7EEF0A934528.codesnippet ├── 667DFB89-10BF-4E87-B0B7-C6FE510039C0.codesnippet ├── 72797966-62D2-4681-A60E-1C1282B01D91.codesnippet ├── 75CFD3A1-DD64-4C00-8E2D-721D57C24E0C.codesnippet ├── 7EDA0F02-A05D-4842-A0B0-D4245644C874.codesnippet ├── 84D35EA8-2335-487E-995D-0E6C3F7EFE26.codesnippet ├── 8555ED95-687B-474F-A8EA-4B2E75E3C4DB.codesnippet ├── 855CD8D5-C57D-4478-B899-81874462BF66.codesnippet ├── 8BF8BB1D-19EC-4114-8A6A-28DB75C24690.codesnippet ├── 8D631166-74E3-428B-8203-1E3AE03642CE.codesnippet ├── 8E782A26-57D7-46AA-A7A4-26C7D1C5EDFB.codesnippet ├── 9609B376-D11C-4614-A395-CEAC817A41AD.codesnippet ├── 9801E4F6-B614-4812-9F6F-929A2AC5C1F6.codesnippet ├── 9A8D08F4-03D7-4DFD-8294-EF75BA23EC29.codesnippet ├── 9B462C4E-3A96-48C6-A96E-413F8ED559FE.codesnippet ├── 9D072C01-9CE1-487E-A2E2-1BE8FF280946.codesnippet ├── A2D42502-610F-4CEE-97FF-5E1BFA85CBBD.codesnippet ├── A7CC3496-1455-4BEE-BA81-D5D8119B36FC.codesnippet ├── AAAE3B99-E865-46F9-8A56-627E90784D08.codesnippet ├── AC206015-B21D-48DF-A5C2-8A43AAD65283.codesnippet ├── ADFB5546-D334-4D83-8D1E-52348564A882.codesnippet ├── AF9BF060-F646-4EA8-AF87-EFAE58E2ADA6.codesnippet ├── B2996EA4-850C-445C-AF44-0099E06B8D24.codesnippet ├── B3F27A0A-B16A-41CD-8A27-43F71985DCDD.codesnippet ├── B93F4FE1-4DC2-4A93-B564-2678EE57047B.codesnippet ├── BB21DA20-E948-4A34-BA89-B72281DCB109.codesnippet ├── BC0BC6B3-8EDA-4B54-AD16-E9454E63DD70.codesnippet ├── BC80ABBD-69C9-4B00-988A-1B05682E374D.codesnippet ├── BDA35160-333C-407A-BEEE-C919DEDBEDDC.codesnippet ├── C20B8144-35DD-4E3B-9819-5D4DD3AAE014.codesnippet ├── C2254ED4-3E35-4EF4-9399-5A0301593553.codesnippet ├── C8D47DA0-DE81-4ED0-83A8-B5CAAEC880D5.codesnippet ├── C9E23A54-176E-4D96-A161-66898DE5DAB1.codesnippet ├── CD84394F-75EE-4F46-9005-FF2631E73FB4.codesnippet ├── CE495CE3-DFDA-455F-A79A-BEB06AFC12C1.codesnippet ├── D027B6AC-F976-4E2D-9AAF-51BCA28365B2.codesnippet ├── D2AFCA2C-FC9B-4934-A31B-35FB745AA900.codesnippet ├── D2D824A2-4C15-4A14-AD00-FAD5CB65D6AD.codesnippet ├── D3584842-BA21-4874-9764-D5AABC6BA891.codesnippet ├── D4CFA1DD-ABBB-420A-91F9-E281BA2A21CE.codesnippet ├── D7A78A68-CFF5-4784-89EB-F4A5CBE1F6CC.codesnippet ├── D8200BC0-1F3A-4AF6-8A45-C3E9CDFBDDBB.codesnippet ├── D89020E3-E379-480F-AB77-80DA3CD459E6.codesnippet ├── D8A7E456-C82D-4B08-ADC3-6C7A7AB2B876.codesnippet ├── DBE05D03-8E40-4CC6-BE45-7BA0271740C5.codesnippet ├── E1768683-9A07-4B22-8D40-31183F91ABB3.codesnippet ├── E1ADA62C-1BCF-4203-8E87-20A4F9D9F99D.codesnippet ├── E6B4F72C-C5F3-48EC-9955-EFD576E2B9B6.codesnippet ├── EAE68142-6711-423E-92AE-BE96B30F1A68.codesnippet ├── F07D2159-3D84-40A5-B19F-08ED45F45E58.codesnippet ├── F17E1EE4-60E5-4380-82C8-3D59C698AA38.codesnippet ├── F24D7311-7985-4072-961A-816C245EE423.codesnippet ├── F30D6D09-05C0-45DA-B530-C0161310EBA3.codesnippet ├── F5759DFB-8019-4670-A848-2B12A488C95C.codesnippet ├── F8DE3C78-B384-40C8-A28C-D79C99EAFFAC.codesnippet ├── FA6ACD61-8BF0-4DCC-87A2-3F2D38617D2C.codesnippet ├── FADF6AB3-1B44-4754-A620-2EEC6975D728.codesnippet └── FD9A2A9C-C8EB-4AD2-B3A0-002047670E22.codesnippet ├── EALayout.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── EALayout.xcscmblueprint ├── EALayout ├── EALayout.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── xcshareddata │ │ └── EALayout.xcscmblueprint ├── EALayout │ ├── EALayout.h │ ├── Info.plist │ └── SkinParser │ │ ├── AutoDataBind.h │ │ ├── AutoDataBind.m │ │ ├── BaseLayouter.h │ │ ├── BaseLayouter.mm │ │ ├── CALayer+SkinParser.h │ │ ├── CALayer+SkinParser.mm │ │ ├── CacheLayout.h │ │ ├── CacheLayout.m │ │ ├── EasyDefine.h │ │ ├── EasyDefine.m │ │ ├── FlowLayout+SkinParser.h │ │ ├── FlowLayout+SkinParser.mm │ │ ├── FlowLayout.h │ │ ├── FlowLayout.mm │ │ ├── LayoutTypeDef.h │ │ ├── LinerLayout+SkinParser.h │ │ ├── LinerLayout+SkinParser.mm │ │ ├── LinerLayout.h │ │ ├── LinerLayout.mm │ │ ├── MatchPattern.h │ │ ├── MatchPattern.mm │ │ ├── NSObject+SkinParser.h │ │ ├── NSObject+SkinParser.mm │ │ ├── SkinKeysDef.h │ │ ├── SkinKeysDef.mm │ │ ├── SkinMgr.h │ │ ├── SkinMgr.mm │ │ ├── SkinParser.h │ │ ├── SkinParser.mm │ │ ├── UIButton+SkinParser.h │ │ ├── UIButton+SkinParser.mm │ │ ├── UIControl+SkinParser.h │ │ ├── UIControl+SkinParser.mm │ │ ├── UILabel+SkinParser.h │ │ ├── UILabel+SkinParser.m │ │ ├── UISearchBar+SkinParser.h │ │ ├── UISearchBar+SkinParser.mm │ │ ├── UISegmentedControl+SkinParser.h │ │ ├── UISegmentedControl+SkinParser.mm │ │ ├── UITableView+SkinParser.h │ │ ├── UITableView+SkinParser.mm │ │ ├── UITableViewCell+SkinParser.h │ │ ├── UITableViewCell+SkinParser.mm │ │ ├── UITextField+SkinParser.h │ │ ├── UITextField+SkinParser.mm │ │ ├── UIView+Layout.h │ │ ├── UIView+Layout.mm │ │ ├── UIView+SkinParser.h │ │ ├── UIView+SkinParser.mm │ │ ├── ViewLayoutDes.h │ │ ├── ViewLayoutDes.mm │ │ ├── ViewLayoutDesImp.h │ │ └── ViewLayoutDesImp.mm └── Extension │ ├── EADebugWindow.h │ ├── EADebugWindow.mm │ ├── EATableViewCell.h │ ├── EATableViewCell.mm │ ├── EAViewController.h │ ├── EAViewController.mm │ ├── Extension.h │ ├── UIView+binddata.h │ └── UIView+binddata.mm ├── EALayoutLiteForOC.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── EALayoutLiteForOC.xcscmblueprint ├── EALayoutLiteForOC ├── AppDelegate.h ├── AppDelegate.m ├── EALayoutLiteForOC.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ ├── 1242x2208@3x.png │ │ ├── 640x1136@2x.png │ │ ├── 640x960@2x.png │ │ ├── 750x1334@2x.png │ │ └── Contents.json ├── Info.plist ├── Resources │ ├── 1024x682@2x.jpg │ ├── ViewController.json │ ├── common.json │ ├── style.json │ └── testicon@2x.jpg ├── ViewController.h ├── ViewController.mm └── main.m ├── README.gif ├── README.md ├── index.html └── installSnippets.sh /1242x2208@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/1242x2208@3x.png -------------------------------------------------------------------------------- /640x1136@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/640x1136@2x.png -------------------------------------------------------------------------------- /640x960@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/640x960@2x.png -------------------------------------------------------------------------------- /750x1334@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/750x1334@2x.png -------------------------------------------------------------------------------- /CodeSnippets/026B352A-B671-44FE-BF49-69F0B5E61CA2.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | borderColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "borderColor":"<#color#>" 13 | IDECodeSnippetIdentifier 14 | 026B352A-B671-44FE-BF49-69F0B5E61CA2 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 边框颜色 19 | IDECodeSnippetTitle 20 | borderColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/09BCBE9D-BD2F-45A2-B1EF-187E64637316.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | returnKeyType 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "returnKeyType":"<#default go google join next route search send yahoo done call#>" 13 | IDECodeSnippetIdentifier 14 | 09BCBE9D-BD2F-45A2-B1EF-187E64637316 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 键盘右下角显示内容 19 | IDECodeSnippetTitle 20 | returnKeyType 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/09EA788B-4783-4244-913F-BFC7C493E582.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | title 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "title":{ 13 | <#stateTitles#> 14 | } 15 | IDECodeSnippetIdentifier 16 | 09EA788B-4783-4244-913F-BFC7C493E582 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | title for 状态 21 | IDECodeSnippetTitle 22 | title 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/0E0A9D29-5753-4AA4-B937-C81CC4DB8121.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | EditingChanged 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "EditingChanged":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | 0E0A9D29-5753-4AA4-B937-C81CC4DB8121 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | EditingChanged:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/0F6658C7-BE25-465B-93A0-2641FA678CEB.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | layerborderColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "layer.borderColor":"<#color#>" 13 | IDECodeSnippetIdentifier 14 | 0F6658C7-BE25-465B-93A0-2641FA678CEB 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | layer.borderColor 19 | IDECodeSnippetTitle 20 | layer.borderColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/1F20C351-4C3F-415E-A290-7CA6AD9F923E.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | AllTouchEvents 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "AllTouchEvents":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | 1F20C351-4C3F-415E-A290-7CA6AD9F923E 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 所有Touch事件 19 | IDECodeSnippetTitle 20 | AllTouchEvents:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/1F5A3E0B-FD9D-46AC-9FBD-1D2B4F20B439.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | layershadowColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "layer.shadowColor":"<#color#>" 13 | IDECodeSnippetIdentifier 14 | 1F5A3E0B-FD9D-46AC-9FBD-1D2B4F20B439 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | layer.shadowColor 19 | IDECodeSnippetTitle 20 | layer.shadowColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/21A02625-1406-484E-A206-8E32D84F80B7.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UIButton 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | 13 | { 14 | "class":"UIButton", 15 | "backgroundColor":"<#color#>", 16 | "titleColor":{ 17 | "normal":"<#color#>", 18 | "selected":"<#color#>" 19 | }, 20 | "layout":{"s":"<#layout#>"} 21 | } 22 | 23 | IDECodeSnippetIdentifier 24 | 21A02625-1406-484E-A206-8E32D84F80B7 25 | IDECodeSnippetLanguage 26 | Xcode.SourceCodeLanguage.JSON 27 | IDECodeSnippetSummary 28 | UIButton for text 29 | IDECodeSnippetTitle 30 | UIButton 31 | IDECodeSnippetUserSnippet 32 | 33 | IDECodeSnippetVersion 34 | 2 35 | 36 | 37 | -------------------------------------------------------------------------------- /CodeSnippets/245004AE-6D4D-4137-9BD6-A54E89A3BAA8.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | EAButton 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | { 13 | "class":"EAButton", 14 | "textColor":"<#color#>", 15 | "font":<#font#>, 16 | "text":"<#text#>" 17 | } 18 | IDECodeSnippetIdentifier 19 | 245004AE-6D4D-4137-9BD6-A54E89A3BAA8 20 | IDECodeSnippetLanguage 21 | Xcode.SourceCodeLanguage.JSON 22 | IDECodeSnippetSummary 23 | UIButton控件的替代品,更简单好用 24 | IDECodeSnippetTitle 25 | EAButton 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /CodeSnippets/259F3024-722C-40D3-A0DE-7C42213B0437.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | class 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "class":"<#class#>" 13 | IDECodeSnippetIdentifier 14 | 259F3024-722C-40D3-A0DE-7C42213B0437 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 19 | IDECodeSnippetTitle 20 | class 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/2A573C0E-AD4D-4B53-9B25-A0C688843D37.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectionStyle 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectionStyle":"<#none blue gray default#>" 13 | IDECodeSnippetIdentifier 14 | 2A573C0E-AD4D-4B53-9B25-A0C688843D37 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | UITableViewCell selection style 19 | IDECodeSnippetTitle 20 | selectionStyle 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/2E8EB0CD-2BD9-4F4D-B2C2-57429988696B.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | subviewsLayout 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "subviewsLayout":{"s":"<#layout#>"} 13 | IDECodeSnippetIdentifier 14 | 2E8EB0CD-2BD9-4F4D-B2C2-57429988696B 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | LinerLayout中对subviews的布局方式 19 | IDECodeSnippetTitle 20 | subviewsLayout 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/2FB74FD4-EDB8-430C-92FA-CBE0417866BA.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | hlImage 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "hlImage":"<#image#>" 13 | IDECodeSnippetIdentifier 14 | 2FB74FD4-EDB8-430C-92FA-CBE0417866BA 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | hlImage highlighted image for eabutton 19 | IDECodeSnippetTitle 20 | hlImage 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/309A4D21-77B4-46C2-98C6-B50C88C05E90.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | disableText 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "disableText":"<#text#>" 13 | IDECodeSnippetIdentifier 14 | 309A4D21-77B4-46C2-98C6-B50C88C05E90 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 不可用状态文字内容 19 | IDECodeSnippetTitle 20 | disableText 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/323649BC-DC5F-431B-8064-C0A031C6E5A3.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | imageForUIButton 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "image":{ 13 | <#images#> 14 | } 15 | IDECodeSnippetIdentifier 16 | 323649BC-DC5F-431B-8064-C0A031C6E5A3 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | 设置UIButton Images,支持多个状态 21 | IDECodeSnippetTitle 22 | image for UIButton 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/459730D5-7ED1-4DE8-8DE1-4F4700A81AD2.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UpInside 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "UpInside":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | 459730D5-7ED1-4DE8-8DE1-4F4700A81AD2 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 按下控件后,在控件区域内松开 19 | IDECodeSnippetTitle 20 | UpInside:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/47E93274-F48D-4DBA-9F32-96761282E415.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UILabel 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | { 13 | "class":"UILabel", 14 | "textColor":<#color#>, 15 | "font":<#font#>, 16 | "layout":{"s":"<#layout#>"} 17 | } 18 | IDECodeSnippetIdentifier 19 | 47E93274-F48D-4DBA-9F32-96761282E415 20 | IDECodeSnippetLanguage 21 | Xcode.SourceCodeLanguage.JSON 22 | IDECodeSnippetSummary 23 | UIlabel控制简单模版 24 | IDECodeSnippetTitle 25 | UILabel 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /CodeSnippets/4F0A6E1C-54EF-4FB9-A7B0-B9874163B8B4.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | layerborderWidth 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "layer.borderWidth":<#width#> 13 | IDECodeSnippetIdentifier 14 | 4F0A6E1C-54EF-4FB9-A7B0-B9874163B8B4 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | layer.borderWidth 19 | IDECodeSnippetTitle 20 | layer.borderWidth 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/5146928C-536E-44E9-9179-99FF560489E8.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | hlText 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "hlText":"<#text#>" 13 | IDECodeSnippetIdentifier 14 | 5146928C-536E-44E9-9179-99FF560489E8 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 高亮状态文件 19 | IDECodeSnippetTitle 20 | hlText 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/52C6B421-418D-4ADD-9296-100D8B1E24BD.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | sizeMode 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "sizeMode":"<#w,h#>" 13 | IDECodeSnippetIdentifier 14 | 52C6B421-418D-4ADD-9296-100D8B1E24BD 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | LinerLayout中,"w"宽度填充,"h"高度填充,可同时使用,如"w,h" 19 | IDECodeSnippetTitle 20 | sizeMode 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/5860ABF7-5E34-48DD-8F1C-B3E92482D9AA.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | DragInside 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "DragInside":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | 5860ABF7-5E34-48DD-8F1C-B3E92482D9AA 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | DragInside:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/5A9921AD-B95E-4138-8422-8035B0B3DA6F.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | contentView 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "contentView":{ 13 | "class":"<#UIView#>", 14 | "layout":{"s":"l,r,<#t,b#>"}, 15 | "addSubview":[ 16 | <#views#> 17 | ] 18 | } 19 | IDECodeSnippetIdentifier 20 | 5A9921AD-B95E-4138-8422-8035B0B3DA6F 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.JSON 23 | IDECodeSnippetSummary 24 | a contentView template 25 | IDECodeSnippetTitle 26 | contentView 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /CodeSnippets/5B5C5024-2099-4B1A-B0CB-175D6E0C0177.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectedImage 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectedImage":"<#image#>" 13 | IDECodeSnippetIdentifier 14 | 5B5C5024-2099-4B1A-B0CB-175D6E0C0177 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | EAButton EAStateView 选中状态下(.selected=true)时图片 19 | IDECodeSnippetTitle 20 | selectedImage 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/5C285C83-B9C9-44D0-A7A5-86B6C92F4E7D.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | strTag 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "strTag":"<#strTag#>" 13 | IDECodeSnippetIdentifier 14 | 5C285C83-B9C9-44D0-A7A5-86B6C92F4E7D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | string tag for readable 19 | IDECodeSnippetTitle 20 | strTag 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/5E6F24F7-F960-4E39-AE3F-58AF74245500.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | layout 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "layout":{"s":"<#layout#>"} 13 | IDECodeSnippetIdentifier 14 | 5E6F24F7-F960-4E39-AE3F-58AF74245500 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 布局器 19 | IDECodeSnippetTitle 20 | layout 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/5EBA8B27-37C2-4414-A026-7EEF0A934528.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectedColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectedColor":<#color#> 13 | IDECodeSnippetIdentifier 14 | 5EBA8B27-37C2-4414-A026-7EEF0A934528 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 选择状态下颜色 19 | IDECodeSnippetTitle 20 | selectedColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/667DFB89-10BF-4E87-B0B7-C6FE510039C0.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | hidden 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "hidden":true, 13 | IDECodeSnippetIdentifier 14 | 667DFB89-10BF-4E87-B0B7-C6FE510039C0 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | hidden the control 19 | IDECodeSnippetTitle 20 | hidden 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/72797966-62D2-4681-A60E-1C1282B01D91.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | disableColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "disableColor":<#color#> 13 | IDECodeSnippetIdentifier 14 | 72797966-62D2-4681-A60E-1C1282B01D91 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 不可用状态颜色 19 | IDECodeSnippetTitle 20 | disableColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/75CFD3A1-DD64-4C00-8E2D-721D57C24E0C.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UIButton 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | { 13 | "class":"UIButton", 14 | "backgroundColor":"<#color#>" 15 | } 16 | IDECodeSnippetIdentifier 17 | 75CFD3A1-DD64-4C00-8E2D-721D57C24E0C 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.JSON 20 | IDECodeSnippetSummary 21 | a UIButton haha 22 | IDECodeSnippetTitle 23 | UIButton 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /CodeSnippets/7EDA0F02-A05D-4842-A0B0-D4245644C874.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | addTarget 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "addTarget":{ 13 | <#events#> 14 | } 15 | IDECodeSnippetIdentifier 16 | 7EDA0F02-A05D-4842-A0B0-D4245644C874 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | 添加事件 21 | IDECodeSnippetTitle 22 | addTarget 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/84D35EA8-2335-487E-995D-0E6C3F7EFE26.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | accessoryType 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "accessoryType":"<#none disclosureIndicator detailDisclosureButton checkmark DetailButton#>" 13 | IDECodeSnippetIdentifier 14 | 84D35EA8-2335-487E-995D-0E6C3F7EFE26 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | For UITableViewCell 19 | IDECodeSnippetTitle 20 | accessoryType 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/8555ED95-687B-474F-A8EA-4B2E75E3C4DB.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | numberOfLines 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "numberOfLines":<#line#> 13 | IDECodeSnippetIdentifier 14 | 8555ED95-687B-474F-A8EA-4B2E75E3C4DB 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | numberOfLines 0 for auto 19 | IDECodeSnippetTitle 20 | numberOfLines 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/855CD8D5-C57D-4478-B899-81874462BF66.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | textColorr 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "textColor":[<#r#>,<#g#>,<#b#>,<#a#>] 13 | IDECodeSnippetIdentifier 14 | 855CD8D5-C57D-4478-B899-81874462BF66 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | r,g,b,a 方式的颜色 r,g,b的范围为[0,255], 透明度a范围[0,1] 19 | IDECodeSnippetTitle 20 | textColor:[r,g,b,a] 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/8BF8BB1D-19EC-4114-8A6A-28DB75C24690.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | disabled 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "disabled":"<#value#>" 13 | IDECodeSnippetIdentifier 14 | 8BF8BB1D-19EC-4114-8A6A-28DB75C24690 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 不可用状态 19 | IDECodeSnippetTitle 20 | disabled:value 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/8D631166-74E3-428B-8203-1E3AE03642CE.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | spacing 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "spacing":<#spacing#> 13 | IDECodeSnippetIdentifier 14 | 8D631166-74E3-428B-8203-1E3AE03642CE 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 间隔空间 19 | IDECodeSnippetTitle 20 | spacing 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/8E782A26-57D7-46AA-A7A4-26C7D1C5EDFB.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | EditingDidEndOnExit 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "EditingDidEndOnExit":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | 8E782A26-57D7-46AA-A7A4-26C7D1C5EDFB 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | EditingDidEndOnExit:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/9609B376-D11C-4614-A395-CEAC817A41AD.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | clipsToBounds 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "clipsToBounds":<#true false#> 13 | IDECodeSnippetIdentifier 14 | 9609B376-D11C-4614-A395-CEAC817A41AD 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | true,裁剪区外部分不显示 19 | IDECodeSnippetTitle 20 | clipsToBounds 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/9801E4F6-B614-4812-9F6F-929A2AC5C1F6.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | backgroundColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "backgroundColor":"<#color#>" 13 | IDECodeSnippetIdentifier 14 | 9801E4F6-B614-4812-9F6F-929A2AC5C1F6 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 背景色 19 | IDECodeSnippetTitle 20 | backgroundColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/9A8D08F4-03D7-4DFD-8294-EF75BA23EC29.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | addSubview 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "addSubview":[ 13 | <#views#> 14 | ] 15 | IDECodeSnippetIdentifier 16 | 9A8D08F4-03D7-4DFD-8294-EF75BA23EC29 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | 添加子view 21 | IDECodeSnippetTitle 22 | addSubview 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/9B462C4E-3A96-48C6-A96E-413F8ED559FE.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | disableImage 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "disableImage":"<#image#>" 13 | IDECodeSnippetIdentifier 14 | 9B462C4E-3A96-48C6-A96E-413F8ED559FE 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 不可用状态图片 19 | IDECodeSnippetTitle 20 | disableImage 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/9D072C01-9CE1-487E-A2E2-1BE8FF280946.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectedBgColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectedBgColor":<#color#> 13 | IDECodeSnippetIdentifier 14 | 9D072C01-9CE1-487E-A2E2-1BE8FF280946 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | selectedBgColor 选中背景色 19 | IDECodeSnippetTitle 20 | selectedBgColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/A2D42502-610F-4CEE-97FF-5E1BFA85CBBD.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | titleColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "titleColor":{ 13 | <#stateTitleColor#> 14 | } 15 | IDECodeSnippetIdentifier 16 | A2D42502-610F-4CEE-97FF-5E1BFA85CBBD 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | title状态颜色 21 | IDECodeSnippetTitle 22 | titleColor 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/A7CC3496-1455-4BEE-BA81-D5D8119B36FC.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | DownRepeat 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "DownRepeat":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | A7CC3496-1455-4BEE-BA81-D5D8119B36FC 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | DownRepeat:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/AAAE3B99-E865-46F9-8A56-627E90784D08.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | Down 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "Down":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | AAAE3B99-E865-46F9-8A56-627E90784D08 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | Down:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/AC206015-B21D-48DF-A5C2-8A43AAD65283.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | textColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "textColor":[<#r#>,<#g#>,<#b#>] 13 | IDECodeSnippetIdentifier 14 | AC206015-B21D-48DF-A5C2-8A43AAD65283 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | r,g,b 方式的颜色,r,g,b的范围为[0,255], a=1,不透明 19 | IDECodeSnippetTitle 20 | textColor:[r,g,b] 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/ADFB5546-D334-4D83-8D1E-52348564A882.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | Cancel 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "Cancel":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | ADFB5546-D334-4D83-8D1E-52348564A882 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应action 19 | IDECodeSnippetTitle 20 | Cancel:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/AF9BF060-F646-4EA8-AF87-EFAE58E2ADA6.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | addTarget 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "addTarget":"<#UpInsideAction#>" 13 | IDECodeSnippetIdentifier 14 | AF9BF060-F646-4EA8-AF87-EFAE58E2ADA6 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | UpInside Action 19 | IDECodeSnippetTitle 20 | addTarget UpInside 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/B2996EA4-850C-445C-AF44-0099E06B8D24.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | layout2 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "layout":{"s":[ 13 | {"s":"<#layout#>"}, 14 | {"s":"<#layout#>"} 15 | ]} 16 | IDECodeSnippetIdentifier 17 | B2996EA4-850C-445C-AF44-0099E06B8D24 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.JSON 20 | IDECodeSnippetSummary 21 | 两个布局器,最多两个 22 | IDECodeSnippetTitle 23 | layout2 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /CodeSnippets/B3F27A0A-B16A-41CD-8A27-43F71985DCDD.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | text 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "text":"<#text#>" 13 | IDECodeSnippetIdentifier 14 | B3F27A0A-B16A-41CD-8A27-43F71985DCDD 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 普通文字内容 19 | IDECodeSnippetTitle 20 | text 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/B93F4FE1-4DC2-4A93-B564-2678EE57047B.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | titleShadowColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "titleShadowColor":{ 13 | <#stateShadowColor#> 14 | } 15 | IDECodeSnippetIdentifier 16 | B93F4FE1-4DC2-4A93-B564-2678EE57047B 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | 阴影颜色 多状态 21 | IDECodeSnippetTitle 22 | titleShadowColor 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/BB21DA20-E948-4A34-BA89-B72281DCB109.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | zeroRectWhenHidden 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "zeroRectWhenHidden":<#false true#> 13 | IDECodeSnippetIdentifier 14 | BB21DA20-E948-4A34-BA89-B72281DCB109 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 隐藏状态时,true(默认)表示忽略其占位,false表明保留占位空间 19 | IDECodeSnippetTitle 20 | zeroRectWhenHidden 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/BC0BC6B3-8EDA-4B54-AD16-E9454E63DD70.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | separatorStyle 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "separatorStyle":"<#none line lineEtched#>" 13 | IDECodeSnippetIdentifier 14 | BC0BC6B3-8EDA-4B54-AD16-E9454E63DD70 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | UITableView分隔样式 19 | IDECodeSnippetTitle 20 | separatorStyle 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/BC80ABBD-69C9-4B00-988A-1B05682E374D.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | contentHeaderView 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "contentHeaderView":{ 13 | "class":"<#UIView#>", 14 | "layout":{"s":"l,r,h=<#h#>"}, 15 | "addSubview":[ 16 | <#views#> 17 | ] 18 | } 19 | IDECodeSnippetIdentifier 20 | BC80ABBD-69C9-4B00-988A-1B05682E374D 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.JSON 23 | IDECodeSnippetSummary 24 | contentHeaderView template 25 | IDECodeSnippetTitle 26 | contentHeaderView 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /CodeSnippets/BDA35160-333C-407A-BEEE-C919DEDBEDDC.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | EditingDidBegin 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "EditingDidBegin":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | BDA35160-333C-407A-BEEE-C919DEDBEDDC 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | EditingDidBegin:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/C20B8144-35DD-4E3B-9819-5D4DD3AAE014.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | DragOutside 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "DragOutside":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | C20B8144-35DD-4E3B-9819-5D4DD3AAE014 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | DragOutside:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/C2254ED4-3E35-4EF4-9399-5A0301593553.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | bottomView 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "bottomView":{ 13 | "class":"<#UIView#>", 14 | "layout":{"s":"l,r,h=<#h#>"}, 15 | "addSubview":[ 16 | <#views#> 17 | ] 18 | } 19 | IDECodeSnippetIdentifier 20 | C2254ED4-3E35-4EF4-9399-5A0301593553 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.JSON 23 | IDECodeSnippetSummary 24 | bottomView template 25 | IDECodeSnippetTitle 26 | bottomView 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /CodeSnippets/C8D47DA0-DE81-4ED0-83A8-B5CAAEC880D5.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | highlighted 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "highlighted":"<#value#>" 13 | IDECodeSnippetIdentifier 14 | C8D47DA0-DE81-4ED0-83A8-B5CAAEC880D5 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 高亮状态 19 | IDECodeSnippetTitle 20 | highlighted:value 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/C9E23A54-176E-4D96-A161-66898DE5DAB1.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | keyboardType 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "keyboardType":"<#Default ASCIICapable NumbersAndPunctuation URL NumberPad PhonePad NamePhonePad EmailAddress DecimalPad Twitter WebSearch#>" 13 | IDECodeSnippetIdentifier 14 | C9E23A54-176E-4D96-A161-66898DE5DAB1 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | keyboardType 19 | IDECodeSnippetTitle 20 | keyboardType 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/CD84394F-75EE-4F46-9005-FF2631E73FB4.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectedText 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectedText":"<#text#>" 13 | IDECodeSnippetIdentifier 14 | CD84394F-75EE-4F46-9005-FF2631E73FB4 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | EAButton EAStateView 选中状态下(.selected=true)时文字内容 19 | IDECodeSnippetTitle 20 | selectedText 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/CE495CE3-DFDA-455F-A79A-BEB06AFC12C1.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | image 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "image":"<#image#>" 13 | IDECodeSnippetIdentifier 14 | CE495CE3-DFDA-455F-A79A-BEB06AFC12C1 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 图片 19 | IDECodeSnippetTitle 20 | image 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D027B6AC-F976-4E2D-9AAF-51BCA28365B2.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | textHlColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "textHlColor":<#color#>, 13 | IDECodeSnippetIdentifier 14 | D027B6AC-F976-4E2D-9AAF-51BCA28365B2 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | EAButton/EAStateView 高亮状态下的文字颜色 19 | IDECodeSnippetTitle 20 | textHlColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D2AFCA2C-FC9B-4934-A31B-35FB745AA900.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | textAlignment 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "textAlignment":"<#left,center,right#>" 13 | IDECodeSnippetIdentifier 14 | D2AFCA2C-FC9B-4934-A31B-35FB745AA900 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 文本对齐方式 left center right 19 | IDECodeSnippetTitle 20 | textAlignment 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D2D824A2-4C15-4A14-AD00-FAD5CB65D6AD.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | layercornerRadius 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "layer.cornerRadius":<#radius#> 13 | IDECodeSnippetIdentifier 14 | D2D824A2-4C15-4A14-AD00-FAD5CB65D6AD 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | layer.cornerRadius 圆角 19 | IDECodeSnippetTitle 20 | layer.cornerRadius 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D3584842-BA21-4874-9764-D5AABC6BA891.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selected 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selected":"<#value#>" 13 | IDECodeSnippetIdentifier 14 | D3584842-BA21-4874-9764-D5AABC6BA891 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 是否选中 [true,false] 19 | IDECodeSnippetTitle 20 | selected 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D4CFA1DD-ABBB-420A-91F9-E281BA2A21CE.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | backgroundImage 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "backgroundImage":{ 13 | <#stateImages#> 14 | } 15 | IDECodeSnippetIdentifier 16 | D4CFA1DD-ABBB-420A-91F9-E281BA2A21CE 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.JSON 19 | IDECodeSnippetSummary 20 | 背景图片 21 | IDECodeSnippetTitle 22 | backgroundImage 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /CodeSnippets/D7A78A68-CFF5-4784-89EB-F4A5CBE1F6CC.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | normal 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "normal":"<#value#>" 13 | IDECodeSnippetIdentifier 14 | D7A78A68-CFF5-4784-89EB-F4A5CBE1F6CC 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 普通状态 19 | IDECodeSnippetTitle 20 | normal : value 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D8200BC0-1F3A-4AF6-8A45-C3E9CDFBDDBB.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | borderWidth 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "borderWidth":<#width#> 13 | IDECodeSnippetIdentifier 14 | D8200BC0-1F3A-4AF6-8A45-C3E9CDFBDDBB 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 边框宽度 19 | IDECodeSnippetTitle 20 | borderWidth 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D89020E3-E379-480F-AB77-80DA3CD459E6.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | linkStyle 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "linkStyle":"<#node#>" 13 | IDECodeSnippetIdentifier 14 | D89020E3-E379-480F-AB77-80DA3CD459E6 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 链接的style结点 19 | IDECodeSnippetTitle 20 | linkStyle 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/D8A7E456-C82D-4B08-ADC3-6C7A7AB2B876.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UIView 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | { 13 | "class":"UIView", 14 | "layout":{"s":"<#layout#>"} 15 | } 16 | IDECodeSnippetIdentifier 17 | D8A7E456-C82D-4B08-ADC3-6C7A7AB2B876 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.JSON 20 | IDECodeSnippetSummary 21 | UIView add a layout 22 | IDECodeSnippetTitle 23 | UIView 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /CodeSnippets/DBE05D03-8E40-4CC6-BE45-7BA0271740C5.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UpOutside 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "UpOutside":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | DBE05D03-8E40-4CC6-BE45-7BA0271740C5 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 按下控件后,在控件区域外松开 19 | IDECodeSnippetTitle 20 | UpOutside:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/E1768683-9A07-4B22-8D40-31183F91ABB3.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | UIImageView 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | { 13 | "class":"UIImageView", 14 | "image":"<#image#>", 15 | "layout":{"s":"<#layout#>"} 16 | } 17 | IDECodeSnippetIdentifier 18 | E1768683-9A07-4B22-8D40-31183F91ABB3 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.JSON 21 | IDECodeSnippetSummary 22 | UIImageView简单模版 23 | IDECodeSnippetTitle 24 | UIImageView 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /CodeSnippets/E1ADA62C-1BCF-4203-8E87-20A4F9D9F99D.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | hlBgColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "hlBgColor":<#color#> 13 | IDECodeSnippetIdentifier 14 | E1ADA62C-1BCF-4203-8E87-20A4F9D9F99D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 高亮状态背景色 19 | IDECodeSnippetTitle 20 | hlBgColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/E6B4F72C-C5F3-48EC-9955-EFD576E2B9B6.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | userInteractionEnabled 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "userInteractionEnabled":<#true false#> 13 | IDECodeSnippetIdentifier 14 | E6B4F72C-C5F3-48EC-9955-EFD576E2B9B6 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 是否能响应事件 19 | IDECodeSnippetTitle 20 | userInteractionEnabled 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/EAE68142-6711-423E-92AE-BE96B30F1A68.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectedHlText 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectedHlText":"<#text#>" 13 | IDECodeSnippetIdentifier 14 | EAE68142-6711-423E-92AE-BE96B30F1A68 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | EAButton EAStateView 选中状态下(.selected=true)时的高亮文字内容 19 | IDECodeSnippetTitle 20 | selectedHlText 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/F07D2159-3D84-40A5-B19F-08ED45F45E58.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | DragEnter 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "DragEnter":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | F07D2159-3D84-40A5-B19F-08ED45F45E58 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | DragEnter:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/F17E1EE4-60E5-4380-82C8-3D59C698AA38.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | selectedHlColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "selectedHlColor":<#color#> 13 | IDECodeSnippetIdentifier 14 | F17E1EE4-60E5-4380-82C8-3D59C698AA38 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | EAButton EAStateView 选中状态下(.selected=true)时高亮文字颜色 19 | IDECodeSnippetTitle 20 | selectedHlColor 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/F24D7311-7985-4072-961A-816C245EE423.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | ValueChanged 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "ValueChanged":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | F24D7311-7985-4072-961A-816C245EE423 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 数据变化时所对应action,如UISwitch 19 | IDECodeSnippetTitle 20 | ValueChanged:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/F30D6D09-05C0-45DA-B530-C0161310EBA3.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | LinerLayout 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | { 13 | "class":"LinerLayout", 14 | "layout":{"s":"<#layout#>"}, 15 | "subviewsLayout":{"s":"<#layout#>"}, 16 | "sizeMode":"<#w,h#>", 17 | "addSubview":[ 18 | <#views#> 19 | ] 20 | } 21 | IDECodeSnippetIdentifier 22 | F30D6D09-05C0-45DA-B530-C0161310EBA3 23 | IDECodeSnippetLanguage 24 | Xcode.SourceCodeLanguage.JSON 25 | IDECodeSnippetSummary 26 | LinerLayout template 27 | IDECodeSnippetTitle 28 | LinerLayout 29 | IDECodeSnippetUserSnippet 30 | 31 | IDECodeSnippetVersion 32 | 2 33 | 34 | 35 | -------------------------------------------------------------------------------- /CodeSnippets/F5759DFB-8019-4670-A848-2B12A488C95C.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | borderStyle 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "borderStyle":"<#none line bezel roundedRect#> 13 | IDECodeSnippetIdentifier 14 | F5759DFB-8019-4670-A848-2B12A488C95C 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | UITextField边框样式 19 | IDECodeSnippetTitle 20 | borderStyle 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/F8DE3C78-B384-40C8-A28C-D79C99EAFFAC.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | DragExit 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "DragExit":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | F8DE3C78-B384-40C8-A28C-D79C99EAFFAC 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 状态对应Action 19 | IDECodeSnippetTitle 20 | DragExit:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/FA6ACD61-8BF0-4DCC-87A2-3F2D38617D2C.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | AllEditingEvents 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "AllEditingEvents":"<#action#>" 13 | IDECodeSnippetIdentifier 14 | FA6ACD61-8BF0-4DCC-87A2-3F2D38617D2C 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 所有编辑事件 19 | IDECodeSnippetTitle 20 | AllEditingEvents:action 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/FADF6AB3-1B44-4754-A620-2EEC6975D728.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | textColor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "textColor":"<#int32#>" 13 | IDECodeSnippetIdentifier 14 | FADF6AB3-1B44-4754-A620-2EEC6975D728 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | 普通文字颜色 19 | IDECodeSnippetTitle 20 | textColor:#00000000 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/FD9A2A9C-C8EB-4AD2-B3A0-002047670E22.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | imageEdgeInsets 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | "imageEdgeInsets":[<#top#>,<#left#>,<#bottom#>,<#right#>] 13 | IDECodeSnippetIdentifier 14 | FD9A2A9C-C8EB-4AD2-B3A0-002047670E22 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.JSON 17 | IDECodeSnippetSummary 18 | UIButton 图片定位 19 | IDECodeSnippetTitle 20 | imageEdgeInsets 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /EALayout.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /EALayout.xcworkspace/xcshareddata/EALayout.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E" : 0, 8 | "EB3D3B4B9575B6717E993164BA29804CF9EDF0BE" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "EEAE71BB-7A34-443F-8F29-39AFCE6ABA38", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E" : "EALayoutLiteForOC\/", 13 | "EB3D3B4B9575B6717E993164BA29804CF9EDF0BE" : "EALayoutLite\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "EALayout", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "EALayout.xcworkspace", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/easycodingTop\/EALayoutLiteForOC.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/easycodingTop\/EALayout.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "EB3D3B4B9575B6717E993164BA29804CF9EDF0BE" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /EALayout/EALayout.xcodeproj/project.xcworkspace/xcshareddata/EALayout.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "CF537F12E2ED817262BC15C17773113879CC15D6", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "CF537F12E2ED817262BC15C17773113879CC15D6" : 0, 8 | "CA203BDDC0BB2BF2A8FB34B80F73876CF2DB2B5C" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "392CD148-FC19-496D-AD26-B82D21D3AAFC", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "CF537F12E2ED817262BC15C17773113879CC15D6" : "Talk-IOS\/", 13 | "CA203BDDC0BB2BF2A8FB34B80F73876CF2DB2B5C" : "" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "EALayout", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "EALayout\/EALayout.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "http:\/\/192.168.100.173\/guoqingming\/ios.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "CA203BDDC0BB2BF2A8FB34B80F73876CF2DB2B5C" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "http:\/\/192.168.100.173\/zhonghui\/Talk-IOS.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "CF537F12E2ED817262BC15C17773113879CC15D6" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /EALayout/EALayout/EALayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // EALayout.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15-7-9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | /* 10 | ********************************************************************** 11 | ** EALayout http://blog.csdn.net/fatherhui/article/details/47011237 ** 12 | ********************************************************************** 13 | */ 14 | #import 15 | 16 | #import "SkinParser.h" 17 | #import "NSObject+SkinParser.h" 18 | #import "UIButton+SkinParser.h" 19 | #import "UISegmentedControl+SkinParser.h" 20 | #import "UITableViewCell+SkinParser.h" 21 | #import "UITableView+SkinParser.h" 22 | #import "UITextField+SkinParser.h" 23 | #import "UIControl+SkinParser.h" 24 | #import "LinerLayout+SkinParser.h" 25 | #import "FlowLayout+SkinParser.h" 26 | #import "UIView+SkinParser.h" 27 | #import "CALayer+SkinParser.h" 28 | #import "MatchPattern.h" 29 | #import "CacheLayout.h" 30 | #import "EasyDefine.h" 31 | #import "UILabel+SkinParser.h" 32 | #import "UISearchBar+SkinParser.h" 33 | #import "Extension.h" 34 | 35 | //! Project version number for EALayout. 36 | FOUNDATION_EXPORT double EALayoutVersionNumber; 37 | 38 | //! Project version string for EALayout. 39 | FOUNDATION_EXPORT const char* EALayoutVersionString; 40 | 41 | // In this header, you should import all the public headers of your framework using statements like #import 42 | -------------------------------------------------------------------------------- /EALayout/EALayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | zh_CN 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleLocalizations 14 | 15 | en 16 | zh_CN 17 | 18 | CFBundleName 19 | $(PRODUCT_NAME) 20 | CFBundlePackageType 21 | FMWK 22 | CFBundleShortVersionString 23 | 1.0 24 | CFBundleSignature 25 | ???? 26 | CFBundleVersion 27 | $(CURRENT_PROJECT_VERSION) 28 | NSPrincipalClass 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/AutoDataBind.h: -------------------------------------------------------------------------------- 1 | // 2 | // AutoDataBind.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/7/12. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AutoDataBind : NSObject 12 | 13 | @property (nonatomic) NSDictionary* keyMap; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/AutoDataBind.m: -------------------------------------------------------------------------------- 1 | // 2 | // AutoDataBind.m 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/7/12. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "AutoDataBind.h" 10 | 11 | @implementation AutoDataBind 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/BaseLayouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseLayouter.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __BASELAYOUTER_H__ 10 | #define __BASELAYOUTER_H__ 11 | 12 | #import 13 | #import 14 | 15 | #import "LayoutTypeDef.h" 16 | 17 | @interface BaseLayouter : UIView 18 | 19 | /** 20 | @brief Layouter里的所有views 21 | */ 22 | @property (nonatomic, strong) NSMutableArray* layoutViews; 23 | 24 | /** 25 | @brief Layouter所在父view顺序位置 26 | */ 27 | @property (nonatomic, readonly) NSInteger indexOfSubview; 28 | 29 | /** 30 | @brief 在解析皮肤时,会按皮肤里定义顺序添加view 31 | */ 32 | - (void)addSubview:(UIView*)view; 33 | 34 | /** 35 | @brief 从layout中称出,并自动调用 removeFromSuperview 36 | */ 37 | - (void)remove:(UIView*)view; 38 | 39 | /** 40 | @brief 从layout里移出控件,并把这些控件从界面移出 41 | */ 42 | - (void)removeAllViews; 43 | 44 | /** 45 | @brief 在普通layout开始前调用 46 | */ 47 | - (void)willLayoutView:(UIView*)view; 48 | 49 | /** 50 | @brief 在布局时会顺序调用该方法,通常在view与 layoutViews.lastObject相等时,便可以开始进行最终布局 51 | */ 52 | - (BOOL)didLayoutView:(UIView*)view; 53 | 54 | /** 55 | @brief 强制调用layout,默认会自动调用 56 | */ 57 | - (void)layout; 58 | 59 | @end 60 | 61 | #endif //__BASELAYOUTER_H__ 62 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/BaseLayouter.mm: -------------------------------------------------------------------------------- 1 | // 2 | // BaseLayouter.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "BaseLayouter.h" 10 | #import "ViewLayoutDes.h" 11 | #import "UIView+Layout.h" 12 | 13 | @interface BaseLayouter() 14 | 15 | @property(nonatomic, weak) UIView* hostView; 16 | 17 | @end 18 | 19 | @implementation BaseLayouter 20 | 21 | - (id)init 22 | { 23 | if( self = [super init] ) 24 | { 25 | _layoutViews = [[NSMutableArray alloc] init]; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)addSubview:(UIView*)view 31 | { 32 | if(self.hostView) 33 | { 34 | if(_layoutViews.lastObject) 35 | { 36 | [self.hostView insertSubview:view aboveSubview:_layoutViews.lastObject]; 37 | } 38 | else 39 | { 40 | [self.hostView insertSubview:view atIndex:_indexOfSubview]; 41 | } 42 | } 43 | [_layoutViews addObject:view]; 44 | } 45 | 46 | - (void)remove:(UIView*)view 47 | { 48 | [_layoutViews removeObject:view]; 49 | [view removeFromSuperview]; 50 | } 51 | 52 | - (BOOL)didLayoutView:(UIView*)view 53 | { 54 | if(_layoutViews.lastObject == view) 55 | { 56 | [self layout]; 57 | return NO; 58 | } 59 | return YES; 60 | } 61 | 62 | - (void)willLayoutView:(UIView*)view 63 | { 64 | 65 | } 66 | 67 | - (void)layout 68 | { 69 | 70 | } 71 | 72 | - (void)didMoveToSuperview 73 | { 74 | UIView* superView = self.superview; 75 | if(superView) 76 | { 77 | self.hostView = superView; 78 | 79 | _indexOfSubview = superView.subviews.count - 1; 80 | 81 | for(NSInteger i=0; i<_layoutViews.count; ++i) 82 | { 83 | [superView addSubview:_layoutViews[i]]; 84 | } 85 | ViewLayoutDes* layoutDes = [superView createViewLayoutDesIfNil]; 86 | layoutDes.layouter = self; 87 | [self removeFromSuperview]; 88 | } 89 | } 90 | 91 | - (void)removeAllViews 92 | { 93 | for(UIView* view in _layoutViews) 94 | { 95 | [view removeFromSuperview]; 96 | } 97 | [_layoutViews removeAllObjects]; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/CALayer+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __CALAYER_SKINPARSER_H__ 10 | #define __CALAYER_SKINPARSER_H__ 11 | 12 | #import "SkinParser.h" 13 | 14 | @interface CALayer(SkinParser) 15 | 16 | /** 17 | @key[String]:borderColor 18 | @value[Color]:颜色对象 19 | @brief 设置Layer borderColor。 20 | 注:因为默认以Color字符器结尾的属性会自动解析为UIColor, 21 | 但此处属性类型为 CGColor, 所以需要特别为其写解析方法 22 | @example "layer.borderColor":"0xFFFF0000" 23 | 此处通常为 "layer.borderColor", 24 | 因为解析通常是相对于View解析,所以需要先取layer再设置layer的属性 25 | */ 26 | DefineParseFun(borderColor); 27 | 28 | /** 29 | @key[String]:backgroundColor 30 | @value[Color]:颜色对象 31 | @brief 设置Layer backgroundColor。 32 | 注:因为默认以Color字符器结尾的属性会自动解析为UIColor, 33 | 但此处属性类型为 CGColor, 所以需要特别为其写解析方法 34 | 35 | @example "layer.backgroundColor":"0xFFFF0000" 36 | 此处通常为 "layer.backgroundColor", 37 | 因为解析通常是相对于View解析,所以需要先取layer再设置layer的属性 38 | */ 39 | DefineParseFun(backgroundColor); 40 | 41 | /** 42 | @key[String]:shadowColor 43 | @value[Color]:颜色对象 44 | @brief 设置Layer shadowColor。 45 | 注:因为默认以Color字符器结尾的属性会自动解析为UIColor, 46 | 但此处属性类型为 CGColor, 所以需要特别为其写解析方法 47 | @example "layer.shadowColor":"0xFFFF0000" 48 | 此处通常为 "layer.shadowColor", 49 | 因为解析通常是相对于View解析,所以需要先取layer再设置layer的属性 50 | */ 51 | DefineParseFun(shadowColor); 52 | 53 | /** 54 | @key[String]:shadowOffset 55 | @value[Array]:size对象 56 | @brief 设置Layer shadowOffset。 57 | @example "layer.shadowOffset":[1,1] 58 | */ 59 | DefineParseFun(shadowOffset); 60 | 61 | @end 62 | 63 | #endif //__CALAYER_SKINPARSER_H__ 64 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/CALayer+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+SkinParser.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "CALayer+SkinParser.h" 10 | 11 | @implementation CALayer(SkinParser) 12 | 13 | #define DEF_DefineParseFun(x) \ 14 | DefineParseFun(x)\ 15 | {\ 16 | self.x = toColor(value).CGColor;\ 17 | } 18 | 19 | DEF_DefineParseFun(borderColor); 20 | 21 | DEF_DefineParseFun(backgroundColor); 22 | 23 | DEF_DefineParseFun(shadowColor); 24 | 25 | DefineParseFun(shadowOffset) 26 | { 27 | self.shadowOffset = toSize(value); 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/CacheLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // CacheLayout.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/7/18. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSObject(CacheLayout) 13 | 14 | //清空lifeCycle上绑定的缓存 15 | - (void)clearCacheLayout; 16 | 17 | - (void)clearCacheValue; 18 | 19 | - (id)cacheValue:(NSObject*)key noCache:(id(^)())noCacheBlock; 20 | 21 | @end 22 | 23 | @interface UIView(CacheLayout) 24 | 25 | /** 26 | @param key 此key 映射cell的布局,如果key一样,布局就完全一样 27 | @param lifeCycle 缓存布局对象的依附对象,即生命周期与lifeCycle一样,或者调用[lifeCycle clearCacheLayout]主动清除缓存布局 28 | */ 29 | - (void)configCache:(NSObject*)key host:(NSObject*)lifeCycle; 30 | 31 | - (BOOL)setNeedCacheLayout; 32 | 33 | - (BOOL)applyCacheLayout; 34 | 35 | @end 36 | 37 | @interface CacheLayout : NSObject 38 | 39 | - (BOOL)cache:(NSObject*)cacheLayoutKey view:(UIView*)view; 40 | 41 | - (BOOL)apply:(NSObject*)cacheLayoutKey view:(UIView*)view; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/CacheLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // CacheLayout.m 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/7/18. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "CacheLayout.h" 10 | #import "EasyDefine.h" 11 | #import 12 | 13 | /*************************** NSObject(CacheLayout) ***************************/ 14 | 15 | @implementation NSObject(CacheLayout) 16 | 17 | - (void)clearCacheLayout 18 | { 19 | self.cacheLayout = nil; 20 | } 21 | 22 | - (void)clearCacheValue 23 | { 24 | self.commonDataDict = nil; 25 | } 26 | 27 | DefAssObj(CacheLayout*, cacheLayout, setCacheLayout, OBJC_ASSOCIATION_RETAIN_NONATOMIC) 28 | 29 | DefAssObj(NSMutableDictionary*, commonDataDict, setCommonDataDict, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 30 | 31 | - (NSMutableDictionary*)commonData 32 | { 33 | NSMutableDictionary* dataDict = self.commonDataDict; 34 | if(!dataDict) 35 | { 36 | dataDict = [NSMutableDictionary dictionary]; 37 | self.commonDataDict = dataDict; 38 | } 39 | return dataDict; 40 | } 41 | 42 | - (id)cacheValue:(NSObject*)key noCache:(id(^)())noCacheBlock 43 | { 44 | id value = nil; 45 | if(key) 46 | { 47 | NSMutableDictionary* dataDict = self.commonData; 48 | value = dataDict[key]; 49 | if(!value && noCacheBlock) 50 | { 51 | value = noCacheBlock(); 52 | if(value) 53 | { 54 | dataDict[key] = value; 55 | } 56 | } 57 | } 58 | return value; 59 | } 60 | 61 | @end 62 | 63 | 64 | /*************************** UIView(CacheLayout) ***************************/ 65 | 66 | @implementation UIView(CacheLayout) 67 | 68 | DefAssObj(NSObject*, cacheLayoutHost, setCacheLayoutHost, OBJC_ASSOCIATION_ASSIGN) 69 | 70 | DefAssObj(NSObject*, cacheLayoutKey, setCacheLayoutKey, OBJC_ASSOCIATION_RETAIN_NONATOMIC) 71 | 72 | - (void)configCache:(NSObject*)key host:(NSObject*)lifeCycle 73 | { 74 | self.cacheLayoutKey = key; 75 | self.cacheLayoutHost = lifeCycle; 76 | } 77 | 78 | - (BOOL)setNeedCacheLayout 79 | { 80 | NSObject* cacheLayoutHost = self.cacheLayoutHost; 81 | NSObject* cacheLayoutKey = self.cacheLayoutKey; 82 | 83 | if(cacheLayoutHost && cacheLayoutKey) 84 | { 85 | CacheLayout* cacheLayout = cacheLayoutHost.cacheLayout; 86 | if(!cacheLayout) 87 | { 88 | cacheLayout = [[CacheLayout alloc] init]; 89 | cacheLayoutHost.cacheLayout = cacheLayout; 90 | } 91 | return [cacheLayout cache:cacheLayoutKey view:self]; 92 | } 93 | return NO; 94 | } 95 | 96 | - (BOOL)applyCacheLayout 97 | { 98 | NSObject* cacheLayoutHost = self.cacheLayoutHost; 99 | NSObject* cacheLayoutKey = self.cacheLayoutKey; 100 | 101 | if(cacheLayoutHost && cacheLayoutKey) 102 | { 103 | CacheLayout* cacheLayout = cacheLayoutHost.cacheLayout; 104 | return [cacheLayout apply:cacheLayoutKey view:self]; 105 | } 106 | return NO; 107 | } 108 | 109 | @end 110 | 111 | /***************************** CacheLayoutItem ******************************/ 112 | 113 | @interface CacheLayoutItem : NSObject 114 | 115 | @property (nonatomic) CGRect frame; 116 | @property (nonatomic) NSMutableArray* subItems; 117 | 118 | - (void)cache:(UIView*)view; 119 | 120 | @end 121 | 122 | @implementation CacheLayoutItem 123 | 124 | - (void)cache:(UIView*)view 125 | { 126 | self.frame = view.frame; 127 | NSArray* subviews = view.subviews; 128 | NSInteger count = subviews.count; 129 | if(count > 0) 130 | { 131 | _subItems = [NSMutableArray arrayWithCapacity:count]; 132 | for(NSInteger i=0; i < count; ++i) 133 | { 134 | CacheLayoutItem* item = [[CacheLayoutItem alloc] init]; 135 | [item cache:subviews[i]]; 136 | [_subItems addObject:item]; 137 | } 138 | } 139 | } 140 | 141 | - (BOOL)applyTo:(UIView*)view 142 | { 143 | if(!CGRectEqualToRect(view.frame, self.frame)) 144 | { 145 | view.frame = self.frame; 146 | } 147 | NSArray* subviews = view.subviews; 148 | NSInteger count = subviews.count; 149 | if(count == _subItems.count) 150 | { 151 | BOOL success = YES; 152 | for(NSInteger i=0; (i < count) && success ; ++i) 153 | { 154 | success &= [_subItems[i] applyTo:subviews[i]]; 155 | } 156 | return success; 157 | } 158 | return NO; 159 | } 160 | 161 | @end 162 | 163 | /***************************** CacheLayout ******************************/ 164 | 165 | @interface CacheLayout() 166 | 167 | @property (nonatomic) NSMutableDictionary*, CacheLayoutItem*>* cacheLayoutItems; 168 | 169 | @end 170 | 171 | @implementation CacheLayout 172 | 173 | - (BOOL)cache:(NSObject*)cacheLayoutKey view:(UIView*)view 174 | { 175 | if(cacheLayoutKey) 176 | { 177 | CacheLayoutItem* item = self.cacheLayoutItems[cacheLayoutKey]; 178 | if(!item) 179 | { 180 | item = [[CacheLayoutItem alloc] init]; 181 | self.cacheLayoutItems[cacheLayoutKey] = item; 182 | } 183 | [item cache:view]; 184 | return YES; 185 | } 186 | return NO; 187 | } 188 | 189 | - (BOOL)apply:(NSObject*)cacheLayoutKey view:(UIView*)view 190 | { 191 | if(cacheLayoutKey) 192 | { 193 | CacheLayoutItem* item = self.cacheLayoutItems[cacheLayoutKey]; 194 | return [item applyTo:view]; 195 | } 196 | return NO; 197 | } 198 | 199 | - (NSMutableDictionary*, CacheLayoutItem*>*)cacheLayoutItems 200 | { 201 | if(!_cacheLayoutItems) 202 | { 203 | _cacheLayoutItems = [NSMutableDictionary*, CacheLayoutItem*> dictionary]; 204 | } 205 | return _cacheLayoutItems; 206 | } 207 | 208 | @end 209 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/EasyDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyDefine.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/7/18. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WeakBox : NSObject 12 | 13 | @property (nonatomic, weak) id weakObj; 14 | 15 | - (id)initWithHost:(id)host; 16 | 17 | @end 18 | 19 | #define DefAssObj(TYPE, proName, SET_NAME, POLICY) \ 20 | static const void* _K##proName = &_K##proName;\ 21 | - (void)SET_NAME:(TYPE)proName\ 22 | {\ 23 | if(OBJC_ASSOCIATION_ASSIGN == POLICY)\ 24 | {\ 25 | objc_setAssociatedObject(self, _K##proName, [[WeakBox alloc] initWithHost:proName], OBJC_ASSOCIATION_RETAIN_NONATOMIC);\ 26 | }\ 27 | else\ 28 | {\ 29 | objc_setAssociatedObject(self, _K##proName, proName, POLICY);\ 30 | }\ 31 | }\ 32 | \ 33 | - (TYPE)proName\ 34 | {\ 35 | TYPE ret = (TYPE)objc_getAssociatedObject(self, _K##proName);\ 36 | if([ret isKindOfClass:[WeakBox class]])\ 37 | {\ 38 | ret = (TYPE)((WeakBox*)ret).weakObj;\ 39 | }\ 40 | return ret;\ 41 | } 42 | 43 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/EasyDefine.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyDefine.m 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/7/18. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "EasyDefine.h" 10 | 11 | @implementation WeakBox 12 | 13 | - (id)initWithHost:(id)host 14 | { 15 | if(self = [super init]) 16 | { 17 | self.weakObj = host; 18 | } 19 | return self; 20 | } 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/FlowLayout+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // FlowLayout+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easylayout on 15/8/15. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "UIView+SkinParser.h" 12 | 13 | @interface FlowLayout(SkinParser) 14 | 15 | /** 16 | @key[String]:subviewsLayout 17 | @value[Dictionary]:layout描述,FlowLayout仅支持一个Layout. 18 | @brief 对该FlowLayout子view进行布局. Layout规则具体见Layout规范文档 19 | @example "subviewsLayout":{"s":"c"} 20 | */ 21 | DefineParseFun(subviewsLayout); 22 | 23 | /** 24 | @key[String]:sizeMode 25 | @value[String]: 子view 宽高适配策略,[w | h | w,h ] 26 | @brief 对该FlowLayout子view进行布局时,宽高适配. Layout规则具体见Layout规范文档 27 | @example "sizeMode":"w,h" 28 | */ 29 | DefineParseFun(sizeMode); 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/FlowLayout+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // FlowLayout+SkinParser.mm 3 | // EALayout 4 | // 5 | // Created by easylayout on 15/8/15. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "FlowLayout+SkinParser.h" 10 | 11 | @implementation FlowLayout(SkinParser) 12 | 13 | DefineParseFun(subviewsLayout) 14 | { 15 | NSInteger mask; 16 | setLayoutStyle(self->style[0], (NSString*)value[sp_s], &mask); 17 | self->style[0].asstag = [value[sp_asstag] intValue]; 18 | self->style[0].align = [value[sp_align] boolValue]; 19 | } 20 | 21 | DefineParseFun(sizeMode) 22 | { 23 | if (isNSNumber(value)) 24 | { 25 | self->sizeMode = (LayoutSizeMode)[value integerValue]; 26 | } 27 | else if isNSString(value) 28 | { 29 | NSString* str = value; 30 | NSArray* array = [str componentsSeparatedByString:@","]; 31 | self->sizeMode = ESizeFixed; 32 | for(NSString* s in array) 33 | { 34 | if([s isEqualToString:@"w"]) 35 | { 36 | self->sizeMode = (LayoutSizeMode)(self->sizeMode | ESizeFillWidth); 37 | } 38 | else if([s isEqualToString:@"h"]) 39 | { 40 | self->sizeMode = (LayoutSizeMode)(self->sizeMode | ESizeFillHeight); 41 | } 42 | } 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/FlowLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // FlowLayout.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/8/10. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseLayouter.h" 11 | 12 | @interface FlowLayout : BaseLayouter 13 | { 14 | @public 15 | LayoutStyle style[1]; 16 | LayoutSizeMode sizeMode; 17 | } 18 | 19 | /** 20 | @brief 控件之间的间距 21 | */ 22 | @property (nonatomic) CGSize spacingSize; 23 | 24 | /** 25 | @brief 固定行高(默认为0), 否则使用当前行最大高度控件的高度作为行高 26 | */ 27 | @property (nonatomic) CGFloat rowHeight; 28 | 29 | @property (nonatomic) NSInteger maxCountPerRow; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/LayoutTypeDef.h: -------------------------------------------------------------------------------- 1 | // 2 | // LayoutTypeDef.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __LAYOUTTYPEDEF_H__ 10 | #define __LAYOUTTYPEDEF_H__ 11 | 12 | #import 13 | 14 | typedef struct LayoutStyle LayoutStyle; 15 | 16 | #define NILV (MAXFLOAT) 17 | 18 | typedef enum LayoutType 19 | { 20 | ELayoutNone, 21 | ELayoutLeft = 1, 22 | ELayoutCenter = 1<<1, 23 | ELayoutRight = 1<<2, 24 | ELAYOUT_HOR_FLAG = 0x0F, 25 | 26 | ELayoutTop = 1<<4, 27 | ELayoutMiddle = 1<<5, 28 | ELayoutBottom = 1<<6, 29 | ELAYOUT_VER_FLAG = ~ELAYOUT_HOR_FLAG, 30 | 31 | ELayoutDefault = ELayoutMiddle 32 | } LayoutType; 33 | 34 | typedef enum AlignType 35 | { 36 | EAlignNone, 37 | EVertical, 38 | EHorizontal, 39 | EBothVerAndHor 40 | } AlignType; 41 | 42 | typedef enum LayoutSizeMode 43 | { 44 | ESizeFixed = 0, 45 | ESizeFillWidth = 1 << 0, 46 | ESizeFillHeight = 1 << 1, 47 | ESizeFillBoth = ESizeFillWidth | ESizeFillHeight 48 | } LayoutSizeMode; 49 | 50 | typedef enum ConstraintMask 51 | { 52 | EConstraintNone = 0, 53 | EConstraintHeight = 1 << 0, 54 | EConstraintWidth = 1 << 1, 55 | EConstraintLeft = 1 << 2, 56 | EConstraintRight = 1 << 3, 57 | EConstraintTop = 1 << 4, 58 | EConstraintBottom = 1 << 5, 59 | EConstraintCenter = 1 << 6, 60 | EConstraintMiddle = 1 << 7 61 | } ConstraintMask; 62 | 63 | typedef enum RefView 64 | { // value must below 16 65 | ERefViewNone, 66 | ERefScreen, 67 | ERefParent, 68 | ERefFriend, 69 | ERefMyself 70 | } RefView; 71 | 72 | typedef enum RefOri 73 | { 74 | ERefOriNone, 75 | ERefLeft, 76 | ERefCenter, 77 | ERefRight, 78 | ERefTop, 79 | ERefMiddle, 80 | ERefBottom, 81 | ERefWidth, 82 | ERefHeight 83 | } RefOri; 84 | 85 | typedef enum RefOpt 86 | { // value must below 16 87 | ERefOptNone, 88 | ERefAdd, 89 | ERefSub, 90 | ERefMul, 91 | ERefDiv 92 | } RefOpt; 93 | 94 | typedef enum RefMutableOri 95 | { 96 | ERefMutableNone = 0, 97 | ERefMutableWidth = 1, 98 | ERefMutableHeight = 1 << 1, 99 | ERefFixedWidth = 1 << 5, 100 | ERefFixedHeight = 1 << 6 101 | } RefMutableOri; 102 | 103 | typedef struct RefRule 104 | { 105 | RefView refView : 4; 106 | RefOri refOri : 4; 107 | RefOpt refOpt : 4; 108 | } RefRule; 109 | 110 | struct LayoutStyle 111 | { 112 | LayoutType layoutType; 113 | AlignType alignType; 114 | struct 115 | { 116 | RefRule 117 | leftRef, 118 | rightRef, 119 | topRef, 120 | bottomRef, 121 | centerRef, 122 | middleRef, 123 | widthRef, 124 | heightRef; 125 | 126 | CGFloat left; 127 | CGFloat top; 128 | CGFloat right; 129 | CGFloat bottom; 130 | CGFloat center; 131 | CGFloat middle; 132 | CGFloat width; 133 | CGFloat height; 134 | }; 135 | 136 | UInt8 mutableOri; 137 | NSInteger asstag; 138 | BOOL align; 139 | }; 140 | 141 | #ifdef __cplusplus 142 | NSInteger setLayoutStyle(LayoutStyle style[] , NSDictionary* dict, NSInteger* mask); 143 | NSInteger setLayoutStyle(LayoutStyle& style , NSString* value, NSInteger* mask); 144 | #endif 145 | 146 | #endif //__LAYOUTTYPEDEF_H__ 147 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/LinerLayout+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // LinerLayout+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __LINERLAYOUT_SKINPARSER_H__ 10 | #define __LINERLAYOUT_SKINPARSER_H__ 11 | 12 | #import "UIView+SkinParser.h" 13 | 14 | @interface LinerLayout(SkinParser) 15 | 16 | /** 17 | @key[String]:subviewsLayout 18 | @value[Dictionary]:layout描述,LinerLayout仅支持一个Layout. 19 | @brief 对该LinerLayout子view进行布局. Layout规则具体见Layout规范文档 20 | @example "subviewsLayout":{"s":"c"} 21 | */ 22 | DefineParseFun(subviewsLayout); 23 | 24 | /** 25 | @key[String]:sizeMode 26 | @value[String]: 子view 宽高适配策略,[w | h | w,h ] 27 | @brief 对该LinerLayout子view进行布局时,宽高适配. Layout规则具体见Layout规范文档 28 | @example "sizeMode":"w,h" 29 | */ 30 | DefineParseFun(sizeMode); 31 | 32 | @end 33 | 34 | #endif //__LINERLAYOUT_SKINPARSER_H__ 35 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/LinerLayout+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // LinerLayout+SkinParser.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "LinerLayout+SkinParser.h" 10 | 11 | @implementation LinerLayout(SkinParser) 12 | 13 | DefineParseFun(subviewsLayout) 14 | { 15 | NSInteger mask; 16 | setLayoutStyle(self->style[0], (NSString*)value[sp_s], &mask); 17 | self->style[0].asstag = [value[sp_asstag] intValue]; 18 | self->style[0].align = [value[sp_align] boolValue]; 19 | } 20 | 21 | DefineParseFun(sizeMode) 22 | { 23 | if (isNSNumber(value)) 24 | { 25 | self->sizeMode = (LayoutSizeMode)[value integerValue]; 26 | } 27 | else if isNSString(value) 28 | { 29 | NSString* str = value; 30 | NSArray* array = [str componentsSeparatedByString:@","]; 31 | self->sizeMode = ESizeFixed; 32 | for(NSString* s in array) 33 | { 34 | if([s isEqualToString:@"w"]) 35 | { 36 | self->sizeMode = (LayoutSizeMode)(self->sizeMode | ESizeFillWidth); 37 | } 38 | else if([s isEqualToString:@"h"]) 39 | { 40 | self->sizeMode = (LayoutSizeMode)(self->sizeMode | ESizeFillHeight); 41 | } 42 | } 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/LinerLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // LinerLayout.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __LINERLAYOUT_H__ 10 | #define __LINERLAYOUT_H__ 11 | 12 | #import 13 | #import "BaseLayouter.h" 14 | 15 | @interface LinerLayout : BaseLayouter 16 | { 17 | @public 18 | LayoutStyle style[1]; 19 | LayoutSizeMode sizeMode; 20 | } 21 | 22 | @property (nonatomic, assign) CGFloat spacing; 23 | 24 | @end 25 | 26 | #endif //__LINERLAYOUT_H__ 27 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/MatchPattern.h: -------------------------------------------------------------------------------- 1 | // 2 | // MatchPattern.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/15. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __MATCHPATTERN_H__ 10 | #define __MATCHPATTERN_H__ 11 | 12 | #import 13 | #import 14 | 15 | @class SkinParser; 16 | typedef id (*ParseFunction)(id value, SkinParser* parser); 17 | 18 | /** 19 | @param subfix 匹配属性名后缀,不区分大小写 20 | @param cls 指定匹配的类, cls为nil, 则添加通用匹配规则 21 | @param fun 匹配成功时使用的解析方法 22 | @brief 当解析某对象属性时, 优先查找当前对象类型匹配规则,如果未查找到,则使用通用匹配规则 23 | */ 24 | bool AddMatchPattern(NSString* subfix, Class cls, ParseFunction fun); 25 | 26 | /** 27 | @param subfix 匹配属性名后缀,不区分大小写 28 | @param cls 指定匹配的类, cls为nil, 则移出通用匹配规则 29 | @brief 移出cls所对应subfix属性解析方法 30 | */ 31 | bool RemoveMatchPattern(NSString* subfix, Class cls); 32 | 33 | /** 34 | @param subfix 匹配属性名后缀,不区分大小写 35 | @param cls 指定匹配的类, cls为nil, 则匹配通用匹配规则 36 | @retval 未找到则返回NULL 37 | @brief 查找cls所对应subfix属性解析方法,如果未找到,则查找通用规则 38 | */ 39 | ParseFunction GetMatchPatternFunciton(NSString* subfix, Class cls); 40 | 41 | #endif //__MATCHPATTERN_H__ 42 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/MatchPattern.mm: -------------------------------------------------------------------------------- 1 | // 2 | // MatchPattern.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/15. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "MatchPattern.h" 12 | 13 | typedef std::vector > MatchPatternList; 14 | static MatchPatternList DefaultMatchPatterns; 15 | 16 | static char MatchPatternsKey; 17 | 18 | static MatchPatternList* GetMatchPatternList(Class cls) 19 | { 20 | MatchPatternList* list = NULL; 21 | if(cls) 22 | { 23 | NSValue* value = objc_getAssociatedObject(cls, &MatchPatternsKey); 24 | list = static_cast(value.pointerValue); 25 | } 26 | return list; 27 | } 28 | 29 | bool AddMatchPattern(NSString* string, Class cls, ParseFunction fun) 30 | { 31 | MatchPatternList* list = &DefaultMatchPatterns; 32 | if(cls) 33 | { 34 | list = GetMatchPatternList(cls); 35 | if(!list) 36 | { 37 | list = new MatchPatternList(); 38 | NSValue* listValue = [NSValue valueWithPointer:list]; 39 | objc_setAssociatedObject(cls, &MatchPatternsKey, listValue, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 40 | } 41 | } 42 | list->push_back(std::pair(string, fun)); 43 | return true; 44 | } 45 | 46 | bool RemoveMatchPattern(NSString* string, Class cls) 47 | { 48 | MatchPatternList* list = &DefaultMatchPatterns; 49 | if(cls) 50 | { 51 | list = GetMatchPatternList(cls); 52 | } 53 | 54 | if(list) 55 | { 56 | for(auto iterator = list->begin(); iterator != list->end(); iterator++) 57 | { 58 | if(iterator->first.hash == string.hash) 59 | { 60 | list->erase(iterator); 61 | return true; 62 | } 63 | } 64 | } 65 | return false; 66 | } 67 | 68 | ParseFunction GetMatchPatternFunciton(NSString* string, Class cls) 69 | { 70 | MatchPatternList* list = NULL; 71 | if(cls) 72 | { 73 | list = GetMatchPatternList(cls); 74 | } 75 | list = list ?: &DefaultMatchPatterns; 76 | for(auto iterator = list->begin(); iterator != list->end(); iterator++) 77 | { 78 | NSString* pattern = iterator->first; 79 | if(pattern.length <= string.length) 80 | { 81 | if(NSOrderedSame == [string compare:pattern options:NSCaseInsensitiveSearch 82 | range:NSMakeRange(string.length - pattern.length, pattern.length)]) 83 | { 84 | return (*iterator).second; 85 | } 86 | } 87 | } 88 | if( list != &DefaultMatchPatterns) 89 | { 90 | return GetMatchPatternFunciton(string, nil); 91 | } 92 | return NULL; 93 | } 94 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/NSObject+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+SkinParser.h 3 | // 4 | // Created by easycoding on 15/7/17. 5 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 6 | // 7 | 8 | #ifndef __NSOBJECT_SKINPARSER_H__ 9 | #define __NSOBJECT_SKINPARSER_H__ 10 | 11 | #import 12 | #import "SkinParser.h" 13 | 14 | @interface NSObject(SkinParser) 15 | 16 | /** 17 | @key[String]: class 18 | @value[String]: className 19 | @brief 需要创建对象的类名, 如果该类使用Swift编写,需要使用 @objc(类)来自动生成Objective-C头文件 20 | @example {"class":"UIView"} 21 | */ 22 | DefineParseFun(class); 23 | 24 | /** 25 | @key[String]: extend 26 | @value[Bool]: true / false 27 | @brief 在解析控件 - (UIView*)parse:(NSString*)viewname view:(UIView*)view; 28 | 读取属性 - (id)valueWithName:(NSString*)name key:(NSString*)key; 29 | extend为true, 则优先解析 common.json里,再解析自身结点, 当自身结点不存在时,直接解析common.json 30 | @example {"extend":true} 31 | */ 32 | DefineParseFun(extend); 33 | 34 | /** 35 | @key[String]: linkStyle 36 | @value1[String]:styleName 37 | @value2[Array]:[styleName] 38 | @brief 该属性会从 style.json 里读取对应 styleName 样式的属性 39 | @example {"linkStyle":"greenStyle"} {"linkStyle":["greenStyle","MyStyle"]} 40 | */ 41 | DefineParseFun(linkStyle); 42 | 43 | /** 44 | @key[String]: other 45 | @value[Dictionary]:自定字典类型 key-value 46 | @brief 解析控件时,不会解析该结点,在单独读取属性使用 47 | @example 48 | { "test": { 49 | "class":"UIView", 50 | "other":{ 51 | "mykey1":aJsonObject 52 | } 53 | } 54 | } 55 | 解析"test"控件时,会忽略"other". 56 | 在使用 [parser valueWithName:@"test" key:@"mykey1"] 可读取 aJsonObject对象; 57 | */ 58 | DefineParseFun(other); 59 | 60 | /** 61 | @key[String]: textAlignment 62 | @value[String]: [left|center|right], default:left [String] 63 | @brief 通常为 UILabel文字对齐方式 64 | @example { "textAlignment":"center" } 65 | */ 66 | DefineParseFun(textAlignment); 67 | 68 | @end 69 | 70 | #endif //__NSOBJECT_SKINPARSER_H__ 71 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/NSObject+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+SkinParser.mm 3 | // 4 | // Created by easycoding on 15/7/17. 5 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "MatchPattern.h" 10 | #import "NSObject+SkinParser.h" 11 | 12 | @implementation NSObject(SkinParser) 13 | 14 | - (id)matchValue:(id)value forKey:(NSString*)key parser:(SkinParser*)parser 15 | { 16 | ParseFunction parseFun = GetMatchPatternFunciton(key, [self class]); 17 | if(parseFun) 18 | { 19 | return parseFun(value, parser); 20 | } 21 | return value; 22 | } 23 | 24 | - (void)parseValue:(id)value forKey:(NSString*)key parser:(SkinParser*)parser 25 | { 26 | NSRange range = [key rangeOfString:@"."]; 27 | if( range.length == 0 ) 28 | { 29 | SEL attrSetFun = NSSelectorFromString([key stringByAppendingString:@":parser:"]); 30 | if([self respondsToSelector:attrSetFun]) 31 | { 32 | int (*TypeMatch)(id, SEL, id, id) = (int (*)(id, SEL, id, id)) objc_msgSend; 33 | TypeMatch(self, attrSetFun, value, parser); 34 | } 35 | else 36 | { 37 | id retV = [self matchValue:value forKey:key parser:parser]; 38 | if(retV) 39 | { 40 | [self setValue:retV forKey:key]; 41 | } 42 | } 43 | } 44 | else 45 | { 46 | id subProKey = [key substringToIndex:range.location]; 47 | id subSubProKeys = [key substringFromIndex:range.location+1]; 48 | id subHost = [self valueForKey:subProKey]; 49 | int (*TypeMatch)(id, SEL, id, id, id) = (int (*)(id, SEL, id, id, id)) objc_msgSend; 50 | TypeMatch(subHost, _cmd, value, subSubProKeys, parser); 51 | } 52 | } 53 | 54 | DefineParseFun(textAlignment) 55 | { 56 | NSTextAlignment alignment = NSTextAlignmentLeft; 57 | if isNSString(value) 58 | { 59 | NSString* align = value; 60 | if ( [sp_center isEqualToString:align] ) 61 | { 62 | alignment = NSTextAlignmentCenter; 63 | } 64 | else if ( [sp_right isEqualToString:align] ) 65 | { 66 | alignment = NSTextAlignmentRight; 67 | } 68 | else if([sp_left isEqualToString:align]) 69 | { 70 | alignment = NSTextAlignmentLeft; 71 | } 72 | } 73 | else 74 | { 75 | alignment = (NSTextAlignment)[value integerValue]; 76 | } 77 | [self setValue:@(alignment) forKey:@"textAlignment"]; 78 | } 79 | 80 | DefineParseFun(linkStyle) 81 | { 82 | [parser parse:value view:(UIView*)self]; 83 | SkinParser* styleParser = [[SkinMgr sharedInstance] getParserByName:sp_style]; 84 | styleParser.isRootParser = YES; 85 | if(isNSArray(value)) 86 | { 87 | for(NSString* valueString in (NSArray*)value) 88 | { 89 | [styleParser parse:valueString view:(UIView*)self]; 90 | } 91 | } 92 | else if(isNSString(value)) 93 | { 94 | [styleParser parse:value view:(UIView*)self]; 95 | } 96 | } 97 | 98 | #define NOUSEDFUN(x) DefineParseFun(x){} 99 | 100 | NOUSEDFUN(class); 101 | NOUSEDFUN(extend); 102 | NOUSEDFUN(other); 103 | NOUSEDFUN(extendView); 104 | 105 | #undef NOUSEDFUN 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/SkinKeysDef.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | extern NSString* sp_class; 5 | extern NSString* sp_extendView; 6 | extern NSString* sp_extend; 7 | extern NSString* sp_center; 8 | extern NSString* sp_left; 9 | extern NSString* sp_right; 10 | extern NSString* sp_bold; 11 | extern NSString* sp_italic; 12 | extern NSString* sp_system; 13 | extern NSString* sp_size; 14 | extern NSString* sp_name; 15 | extern NSString* sp_s; 16 | extern NSString* sp_l; 17 | extern NSString* sp_r; 18 | extern NSString* sp_t; 19 | extern NSString* sp_b; 20 | extern NSString* sp_c; 21 | extern NSString* sp_C; 22 | extern NSString* sp_m; 23 | extern NSString* sp_w; 24 | extern NSString* sp_W; 25 | extern NSString* sp_h; 26 | extern NSString* sp_H; 27 | extern NSString* sp_resizeCap; 28 | extern NSString* sp_mode; 29 | extern NSString* sp_asstag; 30 | extern NSString* sp_tag; 31 | extern NSString* sp_minSize; 32 | extern NSString* sp_maxSize; 33 | extern NSString* sp_minW; 34 | extern NSString* sp_minH; 35 | extern NSString* sp_maxW; 36 | extern NSString* sp_maxH; 37 | extern NSString* sp_style; 38 | extern NSString* sp_common; 39 | extern NSString* sp_other; 40 | extern NSString* sp_align; 41 | 42 | 43 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/SkinKeysDef.mm: -------------------------------------------------------------------------------- 1 | 2 | #import "SkinKeysDef.h" 3 | 4 | NSString* sp_class = @"class"; 5 | NSString* sp_extendView = @"extendView"; 6 | NSString* sp_extend = @"extend"; 7 | NSString* sp_center = @"center"; 8 | NSString* sp_left = @"left"; 9 | NSString* sp_right = @"right"; 10 | NSString* sp_bold = @"bold"; 11 | NSString* sp_italic = @"italic"; 12 | NSString* sp_system = @"system"; 13 | NSString* sp_size = @"size"; 14 | NSString* sp_name = @"name"; 15 | NSString* sp_s = @"s"; 16 | NSString* sp_w = @"w"; 17 | NSString* sp_W = @"W"; 18 | NSString* sp_h = @"h"; 19 | NSString* sp_H = @"H"; 20 | NSString* sp_l = @"l"; 21 | NSString* sp_r = @"r"; 22 | NSString* sp_t = @"t"; 23 | NSString* sp_b = @"b"; 24 | NSString* sp_c = @"c"; 25 | NSString* sp_C = @"C"; 26 | NSString* sp_m = @"m"; 27 | NSString* sp_asstag = @"asstag"; 28 | NSString* sp_align = @"align"; 29 | NSString* sp_tag = @"tag"; 30 | NSString* sp_minSize = @"minSize"; 31 | NSString* sp_maxSize = @"maxSize"; 32 | NSString* sp_minW = @"minW"; 33 | NSString* sp_minH = @"minH"; 34 | NSString* sp_maxW = @"maxW"; 35 | NSString* sp_maxH = @"maxH"; 36 | NSString* sp_style = @"style"; 37 | NSString* sp_common = @"common"; 38 | NSString* sp_resizeCap = @"resizeCap"; 39 | NSString* sp_mode = @"mode"; 40 | NSString* sp_other = @"other"; 41 | 42 | 43 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/SkinMgr.h: -------------------------------------------------------------------------------- 1 | // 2 | // SkinMgr.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __SKINMGR_H__ 10 | #define __SKINMGR_H__ 11 | 12 | #import 13 | 14 | @class UIImage; 15 | @class SkinParser; 16 | 17 | @interface SkinMgr : NSObject 18 | 19 | @property (nonatomic, copy) NSString* __nonnull extensionPath; 20 | @property (nonatomic, copy) NSString* __nonnull rootPath; 21 | 22 | + (instancetype __nullable)sharedInstance; 23 | 24 | - (SkinParser* __nullable)getParserByName:(NSString* __nullable)filename; 25 | 26 | - (SkinParser* __nullable)getParserByData:(NSData* __nullable)data; 27 | 28 | - (SkinParser* __nullable)getStyleParser; 29 | 30 | - (SkinParser* __nullable)getCommonParser; 31 | 32 | - (UIImage* __nullable)image:(NSString* __nullable)filename; 33 | 34 | @end 35 | 36 | #endif //__SKINMGR_H__ 37 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/SkinMgr.mm: -------------------------------------------------------------------------------- 1 | // 2 | // SkinMgr.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "SkinMgr.h" 10 | #import "SkinParser.h" 11 | 12 | @implementation SkinMgr 13 | { 14 | SkinParser* _cacheCommonParser; 15 | SkinParser* _cacheStyleParser; 16 | NSMutableArray* _jsonSearchPaths; 17 | } 18 | 19 | - (SkinParser*)getCommonParser 20 | { 21 | #ifdef DEBUG 22 | _cacheCommonParser = nil; 23 | #endif 24 | if(!_cacheCommonParser) 25 | { 26 | _cacheCommonParser = [self getParserByName:@"common"]; 27 | } 28 | return _cacheCommonParser; 29 | } 30 | 31 | - (SkinParser*)getStyleParser 32 | { 33 | #ifdef DEBUG 34 | _cacheStyleParser = nil; 35 | #endif 36 | 37 | if(!_cacheStyleParser) 38 | { 39 | _cacheStyleParser = [self getParserByName:@"style"]; 40 | } 41 | return _cacheStyleParser; 42 | } 43 | 44 | - (SkinParser*)getParserByName:(NSString*)filename 45 | { 46 | if(!filename) 47 | { 48 | return [self getCommonParser]; 49 | } 50 | else 51 | { 52 | filename = [filename componentsSeparatedByString:@"."].lastObject; 53 | } 54 | 55 | filename = [filename stringByAppendingString:@".json"]; 56 | NSString* filepath = [self searchFiles:filename]; 57 | if ( filepath ) 58 | { 59 | return [self getParserByData:[NSData dataWithContentsOfFile:filepath]]; 60 | } 61 | else if(![filename isEqualToString:@"common.json"]) 62 | { 63 | return [self getCommonParser]; 64 | } 65 | return nil; 66 | } 67 | 68 | - (NSString*)searchFiles:(NSString*)name 69 | { 70 | NSFileManager* fileMgr = [NSFileManager defaultManager]; 71 | NSString* filepath = [_extensionPath stringByAppendingPathComponent:name]; 72 | if(!filepath || ![fileMgr fileExistsAtPath:filepath]) 73 | { 74 | filepath = [_rootPath stringByAppendingPathComponent:name]; 75 | if(filepath && ![fileMgr fileExistsAtPath:filepath]) 76 | { 77 | filepath = nil; 78 | } 79 | } 80 | return filepath; 81 | } 82 | 83 | - (SkinParser*)getParserByData:(NSData *)data 84 | { 85 | if(data) 86 | { 87 | NSDictionary* dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; 88 | if(dict) 89 | { 90 | return [[SkinParser alloc] init:dict]; 91 | } 92 | else 93 | { 94 | NSLog(@"json文件格式可能有误,请使用工具检查(附工具:http://www.kjson.com)"); 95 | } 96 | } 97 | return nil; 98 | } 99 | 100 | - (UIImage* __nullable)image:(NSString*)filename 101 | { 102 | UIImage* image = nil; 103 | if(_extensionPath) 104 | { 105 | NSString* imagePath = [_extensionPath stringByAppendingPathComponent:filename]; 106 | if(imagePath) 107 | { 108 | image = [UIImage imageWithContentsOfFile:imagePath]; 109 | } 110 | } 111 | if(!image) 112 | { 113 | NSString* imagePath = [_rootPath stringByAppendingPathComponent:filename]; 114 | if(imagePath) 115 | { 116 | image = [UIImage imageWithContentsOfFile:imagePath]; 117 | } 118 | } 119 | return image; 120 | } 121 | 122 | extern CGRect S_rect; 123 | + (instancetype)sharedInstance 124 | { 125 | static dispatch_once_t pred = 0; 126 | static SkinMgr* gSkinMgr = nil; 127 | dispatch_once(&pred, ^{ 128 | gSkinMgr = [[SkinMgr alloc] init]; 129 | gSkinMgr.rootPath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:@"skins"]; 130 | S_rect = [UIScreen mainScreen].bounds; 131 | }); 132 | return gSkinMgr; 133 | } 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __SKNPARSER_H__ 10 | #define __SKNPARSER_H__ 11 | 12 | #import 13 | #import 14 | #import "UIView+Layout.h" 15 | #import "SkinKeysDef.h" 16 | #import "SkinMgr.h" 17 | #import "LinerLayout.h" 18 | #import "FlowLayout.h" 19 | #import "ViewLayoutDes.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #define isNSArray(x) ( [(x) isKindOfClass:[NSArray class]] ) 26 | #define isNSDictionary(x) ( [(x) isKindOfClass:[NSDictionary class]] ) 27 | #define isNSString(x) ( [(x) isKindOfClass:[NSString class]] ) 28 | #define isNSNumber(x) ( [(x) isKindOfClass:[NSNumber class]] ) 29 | 30 | #define DefineParseFun(_property) \ 31 | - (void)_property:(id)value parser:(SkinParser*)parser 32 | 33 | @interface SkinParser : NSObject 34 | 35 | /** 36 | @brief 设置当前事件target, 如解析 button addTarget时 37 | */ 38 | @property (nonatomic,weak) id eventTarget; 39 | 40 | @property (nonatomic, assign) BOOL isRootParser; 41 | 42 | + (instancetype)getParserByData:(NSData*)data; 43 | 44 | + (instancetype)getParserByName:(NSString*)filename; 45 | 46 | + (void)setLocalString:(NSString*(^)(NSString* key))toLocalString; 47 | 48 | + (NSString*)ToLocalString:(NSString*)string; 49 | 50 | - (instancetype)init:(NSDictionary*)dict; 51 | 52 | /** 53 | @param key, 对应view的key 54 | @param view, 需要解析属性的view, 如果为nil, 则创建. 并返回该view 55 | @retval 返回传入的view,或者创建的view 56 | @details 1:如果该结点key存在,并且 "extend":true,则会先解析common属性,再解析当前解析属性。 57 | 2:如果该结点key不存在,则直接解析common属性 58 | */ 59 | - (UIView*)parse:(NSString*)key view:(UIView* )view; 60 | 61 | /** 62 | @brief 当于调用[parser parse:key view:nil] 63 | */ 64 | - (__kindof UIView*)parse:(NSString*)key; 65 | 66 | /** 67 | @brief 通过字典解析view 68 | */ 69 | - (UIView*)parse:(UIView*)view attr:(NSDictionary*)dict; 70 | 71 | /** 72 | @brief 获取key结点下对应name的图片 73 | */ 74 | - (UIImage*)imageWithName:(NSString*)name key:(NSString*)key; 75 | 76 | /** 77 | @brief 通过文件相对路径获取图片 78 | */ 79 | - (UIImage*)imageWithPath:(NSString*)path; 80 | 81 | /** 82 | @brief 获取key结点下对应name的颜色 83 | */ 84 | - (UIColor*)colorWithName:(NSString*)name key:(NSString*)key; 85 | 86 | /** 87 | @brief 获取key结点下对应name的结点 88 | */ 89 | - (id)valueWithName:(NSString*)name key:(NSString*)key; 90 | 91 | - (id)objectForKeyedSubscript:(NSString*)key; 92 | 93 | /** 94 | @brief 字符串解析为UIColor对象 "#aarrggbb" "0xaarrggbb" "blackColor"(UIColor方法) 95 | */ 96 | + (UIColor*)StringToColor:(NSString*)string; 97 | 98 | @end 99 | 100 | /*=================== C parse function ====================*/ 101 | /* 102 | [width, height] ==> CGSize 103 | */ 104 | CGSize toSize(NSArray* array); 105 | 106 | /* 107 | "a string" ==> NSString 108 | */ 109 | NSString* toString(id value); 110 | 111 | /* 112 | "#FFFFFFFF" ==> UIColor 113 | "0xFFFFFFFF" ==> UIColor 114 | [r,g,b,a] ==> UIColor 115 | [r,g,b] ==> UIColor 116 | "blackColor" ==> UIColor.blackColor 117 | */ 118 | UIColor* toColor(id value); 119 | 120 | /* 121 | "imagename.png" ==> UIImage 122 | */ 123 | UIImage* toImage(id value); 124 | 125 | /* 126 | ["imagename0.png","imagename1.png","imagenameN.png"] ==> [UIImage] 127 | */ 128 | NSArray* toImageArray(id value); 129 | 130 | /* 131 | [x, y, width, height] ==> CGRect 132 | */ 133 | CGRect toRect(NSArray* array); 134 | 135 | /* 136 | 15 ==> [UIFont systemFontOfSize:15] 137 | {"size":15, "name":"bold"} ==> [UIFont boldSystemFontOfSize:15] 138 | */ 139 | UIFont* toFont(id value); 140 | 141 | /* 142 | { 143 | "class":"UIView", ==> UIView 144 | "xxx":"xxx" 145 | } 146 | */ 147 | UIView* toView(id value, SkinParser* parser); 148 | 149 | NSAttributedString *toAttributedString(id value,SkinParser* parser); 150 | 151 | /* 152 | "never" ==> UITextFieldViewMode 153 | */ 154 | UITextFieldViewMode toViewMode(id value, SkinParser* parser); 155 | 156 | #pragma mark ParseFunctions 157 | 158 | id MakeColorValue(id value, SkinParser* parser); 159 | 160 | id MakeRectValue(id value, SkinParser* parser); 161 | 162 | id MakeImageValue(id value, SkinParser* parser); 163 | 164 | id MakeImageArrayValue(id value, SkinParser* parser); 165 | 166 | id MakeSizeValue(id value, SkinParser* parser); 167 | 168 | id MakeInsetValue(id value, SkinParser* parser); 169 | 170 | id MakeFontValue(id value, SkinParser* parser); 171 | 172 | id MakeViewValue(id value, SkinParser* parser); 173 | 174 | id MakeViewModeValue(id value, SkinParser* parser); 175 | 176 | id MakeAttributeValue(id value, SkinParser* parser); 177 | 178 | /** 179 | * 框架默认已添加部分通用解析方法,如有需要,可自行添加需要的方法 180 | */ 181 | 182 | /* 183 | * 所有后缀为 color 的属性会自动匹配 MakeColorValue解析方法,设置对应UIColor 184 | * 185 | * AddMatchPattern(@"color", nil, MakeColorValue); //UIColor 186 | */ 187 | 188 | /* 189 | * 所有后缀为 image 的属性会自动匹配 MakeImageValue解析方法,设置对应UIImage 190 | * 191 | * AddMatchPattern(@"image", nil, MakeImageValue); //UIImage 192 | */ 193 | 194 | /* 以下 与上 同理 */ 195 | //AddMatchPattern(@"images", nil, MakeImageArrayValue); //NSArray 196 | //AddMatchPattern(@"font", nil, MakeFontValue); //UIFont 197 | //AddMatchPattern(@"frame", nil, MakeRectValue); //CGRect 198 | //AddMatchPattern(@"size", nil, MakeSizeValue); //CGSize 199 | //AddMatchPattern(@"Insets", nil, MakeInsetValue); //UIEdgeInsets 200 | //AddMatchPattern(@"Inset", nil, MakeInsetValue); //UIEdgeInsets 201 | //AddMatchPattern(@"View", nil, MakeViewValue); //UIView 202 | //AddMatchPattern(@"ViewMode",nil, MakeViewModeValue);//UITextFieldViewMode 203 | //AddMatchPattern(@"attributedText",nil, MakeAttributeValue);//NSAttributedString 204 | 205 | #ifdef __cplusplus 206 | } 207 | #endif 208 | 209 | #endif //__SKNPARSER_H__ 210 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UIButton+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __UIBUTTON_SKINPARSER_H__ 10 | #define __UIBUTTON_SKINPARSER_H__ 11 | 12 | #import 13 | #import "SkinParser.h" 14 | 15 | /** 16 | @brief 建议直接使用 EAButton, 在完整版里会有自定义控件EAButton,比UIButton更好用 17 | */ 18 | @interface UIButton(SkinParser) 19 | 20 | /** 21 | @key[String]:image 22 | @value[Dictionary/String]:不同状态对应图片 23 | @brief Dictionary:状态包含["normal", "highlighted", "disabled", "selected"], 24 | String: 相当于设置 "normal" 状态对应图片 25 | @example 26 | Dictionary : 27 | "image":{ 28 | "normal":"mytestImage/normal.png", 29 | "selected":"selected.png" 30 | } 31 | String: "image":"mytestImage/normal.png" 32 | */ 33 | DefineParseFun(image); 34 | 35 | /** 36 | @key[String]:backgroundImage 37 | @value[Dictionary/String]:不同状态对应背景图片 38 | @brief Dictionary:状态包含["normal", "highlighted", "disabled", "selected"], 39 | String: 相当于设置 "normal" 状态对应背景图片 40 | @example 41 | Dictionary : 42 | "backgroundImage":{ 43 | "normal":"mytestImage/normalbackgroundImage.png", 44 | "selected":"selectedbackgroundImage.png" 45 | } 46 | String: "backgroundImage":"mytestImage/normalbackgroundImage.png" 47 | */ 48 | DefineParseFun(backgroundImage); 49 | 50 | /** 51 | @key[String]:title 52 | @value[Dictionary/String]:不同状态对应文字 53 | @brief Dictionary:状态包含["normal", "highlighted", "disabled", "selected"], 54 | String: 相当于设置 "normal" 状态对应文字 55 | @example 56 | Dictionary : 57 | "title":{ 58 | "normal":"titlenormal", 59 | "selected":"titlehighlighted" 60 | } 61 | String: "title":"titlenormal" 62 | */ 63 | DefineParseFun(title); 64 | 65 | /** 66 | @key[String]:titleColor 67 | @value[Dictionary/Color]:不同状态对应文字颜色 68 | @brief Dictionary:状态包含["normal", "highlighted", "disabled", "selected"], 69 | String: 相当于设置 "normal" 状态对应文字颜色 70 | @example 71 | Dictionary : 72 | "titleColor":{ 73 | "normal":"blueColor", 74 | "selected":[255,0,0], 75 | } 76 | Color: "titleColor":[0,0,255,0.5] 77 | */ 78 | DefineParseFun(titleColor); 79 | 80 | /** 81 | @key[String]:titleShadowColor 82 | @value[Dictionary/Color]:不同状态对应文字阴影颜色 83 | @brief Dictionary:状态包含["normal", "highlighted", "disabled", "selected"], 84 | String: 相当于设置 "normal" 状态对应文字阴影颜色 85 | @example 86 | Dictionary : 87 | "titleShadowColor":{ 88 | "normal":"blueColor", 89 | "selected":[255,0,0], 90 | } 91 | Color: "titleShadowColor":[0,0,255,0.5] 92 | */ 93 | DefineParseFun(titleShadowColor); 94 | 95 | /** 96 | @key[String]:text 97 | @value[String]: button normal状态对应文字 98 | @brief title的简写,为了兼容UILabel设置文字的使用习惯 99 | @example "text":"I am normal title" 100 | */ 101 | - (void)setText:(NSString*)str; 102 | 103 | /** 104 | @key[String]:textColor 105 | @value[Color]: button normal状态对应文字颜色 106 | @brief titleColor的简写,为了兼容UILabel设置文字颜色的使用习惯 107 | @example "titleColor":"#FFFF0000" 108 | */ 109 | - (void)setTextColor:(UIColor*)color; 110 | 111 | @end 112 | 113 | #endif //__UIBUTTON_SKINPARSER_H__ 114 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UIButton+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+SkinParser.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UIButton+SkinParser.h" 10 | #import "UIControl+SkinParser.h" 11 | 12 | @interface UIControl() 13 | - (UIControlState)valueOfUIControlState:(NSString*)stateStr; 14 | @end 15 | 16 | @implementation UIButton(SkinParser) 17 | 18 | #define DefineUIControlStateFun(_key, _setFun, _parseFun)\ 19 | \ 20 | DefineParseFun(_key)\ 21 | {\ 22 | if ( isNSString(value) )\ 23 | {\ 24 | [self _setFun:_parseFun(value) forState:UIControlStateNormal];\ 25 | }\ 26 | else if (isNSDictionary(value))\ 27 | {\ 28 | NSDictionary* dict = (NSDictionary*)value;\ 29 | for( NSString* key in dict)\ 30 | {\ 31 | UIControlState state = [self valueOfUIControlState:key];\ 32 | [self _setFun:_parseFun(dict[key]) forState:state];\ 33 | }\ 34 | }\ 35 | } 36 | 37 | NSString* toLocalString(NSString* str) 38 | { 39 | return [SkinParser ToLocalString:str]; 40 | } 41 | 42 | DefineUIControlStateFun(image, setImage, toImage) 43 | 44 | DefineUIControlStateFun(backgroundImage, setBackgroundImage, toImage) 45 | 46 | DefineUIControlStateFun(title, setTitle, toLocalString) 47 | 48 | DefineUIControlStateFun(titleColor, setTitleColor, toColor) 49 | 50 | DefineUIControlStateFun(titleShadowColor, setTitleShadowColor, toColor) 51 | 52 | - (void)setText:(NSString*)str 53 | { 54 | [self setTitle: [SkinParser ToLocalString:str] forState:(UIControlStateNormal)]; 55 | } 56 | 57 | - (void)setTextColor:(UIColor*)color 58 | { 59 | [self setTitleColor:color forState:(UIControlStateNormal)]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UIControl+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "SkinParser.h" 10 | 11 | @interface UIControl(SkinParser) 12 | 13 | /* 14 | @key[String]:addTarget 15 | @value[Dictionary/String]: 不同状态所对应事件,绑定对象为, 当前parser.eventTarget,通常设置当前viewController 16 | @brief 绑定事件响应函数,事件为 [ 17 | "Down","DownRepeat","DragInside","DragOutside","DragEnter", 18 | "DragExit","UpInside","UpOutside","Cancel", 19 | "ValueChanged", 20 | "EditingDidBegin","EditingChanged","EditingDidEndOnExit","AllTouchEvents","AllEditingEvents"] 21 | 详情见 UIControlEvents 枚举 22 | @example Dictionary: 23 | "addTarget":{ 24 | "UpInside":"aUpAction:", 25 | "DragOutside":"dragOutAction" 26 | } 27 | String: {"addTarget":"aUpAction:"} 给"UpInside"事件响应 "aUpAction:"消息 28 | */ 29 | DefineParseFun(addTarget); 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UIControl+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+SkinParser.m 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UIControl+SkinParser.h" 10 | #import "SkinParser.h" 11 | 12 | @implementation UIControl(SkinParser) 13 | 14 | - (UIControlState)valueOfUIControlState:(NSString*)stateStr 15 | { 16 | NSArray* stateStrArray = @[@"normal", @"highlighted", @"disabled", @"selected"]; 17 | UIControlState stateValueArray[] = { 18 | UIControlStateNormal, 19 | UIControlStateHighlighted, 20 | UIControlStateDisabled, 21 | UIControlStateSelected 22 | }; 23 | 24 | for(NSInteger i=0; i 10 | 11 | #import 12 | 13 | @interface UILabel(SkinParser) 14 | 15 | /** 16 | @key[String]:text 17 | @value[String]: 显示字符串 18 | @example "text":"文本" 19 | */ 20 | DefineParseFun(text); 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UILabel+SkinParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+SkinParser.m 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/3/22. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UILabel+SkinParser.h" 10 | 11 | @implementation UILabel(SkinParser) 12 | 13 | DefineParseFun(text) 14 | { 15 | self.text = [SkinParser ToLocalString:value]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UISearchBar+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchBar+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/3/22. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import 12 | 13 | @interface UISearchBar(SkinParser) 14 | 15 | DefineParseFun(placeholder); 16 | 17 | DefineParseFun(backgroundColor); 18 | 19 | @end 20 | 21 | 22 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UISearchBar+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // UISearchBar+SkinParser.m 3 | // EALayout 4 | // 5 | // Created by easycoding on 16/3/22. 6 | // Copyright © 2016年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UISearchBar+SkinParser.h" 10 | #import 11 | 12 | @implementation UISearchBar(SkinParser) 13 | 14 | DefineParseFun(placeholder) 15 | { 16 | self.placeholder = [SkinParser ToLocalString:value]; 17 | } 18 | 19 | - (UITextField*)textField 20 | { 21 | static void* textFieldKey = &textFieldKey; 22 | 23 | UITextField* theTextField = (UITextField*)objc_getAssociatedObject(self, textFieldKey); 24 | 25 | if(!theTextField && self.subviews.count) 26 | { 27 | self.placeholder = self.placeholder; 28 | UIView* needRemoveView = nil; 29 | for (UIView* view in self.subviews[0].subviews) 30 | { 31 | if ([view isKindOfClass:[UITextField class]]) 32 | { 33 | UITextField *textFieldObject = (UITextField *)view; 34 | theTextField = textFieldObject; 35 | } 36 | else if(!needRemoveView && [view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) 37 | { 38 | needRemoveView = view; 39 | } 40 | } 41 | [needRemoveView removeFromSuperview]; 42 | objc_setAssociatedObject(self, textFieldKey, theTextField, OBJC_ASSOCIATION_ASSIGN); 43 | } 44 | return theTextField; 45 | } 46 | 47 | DefineParseFun(backgroundColor) 48 | { 49 | UIColor* bgcolor = toColor(value); 50 | 51 | UIColor* hookColor = [UIColor clearColor]; 52 | super.backgroundColor = hookColor; 53 | float version = [[[UIDevice currentDevice] systemVersion] floatValue]; 54 | if (version < 7.1) 55 | { 56 | [ self setBarTintColor:hookColor]; 57 | } 58 | self.textField.backgroundColor = bgcolor; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UISegmentedControl+SkinParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControl+SkinParser.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/8/15. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UIControl+SkinParser.h" 10 | 11 | @interface UISegmentedControl(SkinParser) 12 | 13 | /** 14 | @key[String]:titles 15 | @value[Array]:title数组 16 | @example 17 | Array : 18 | "titles":["title1","title2","title3"] 19 | */ 20 | DefineParseFun(titles); 21 | 22 | /** 23 | @key[String]:dividerImage 24 | @value[Dictionary]:不同状态对应的图片 25 | @brief left,right 默认normal ["normal", "highlighted", "disabled", "selected"] 26 | metrics 默认default, ["default","compact","defaultPrompt","compactPrompt"] 27 | @example 28 | "dividerImage":{ 29 | "image":"image.png", 30 | "left":"normal", 31 | "right":"normal", 32 | "metrics":"default" 33 | } 34 | */ 35 | DefineParseFun(dividerImage); 36 | 37 | /** 38 | @key[String]:titleTextAttributes 39 | @value[Dictionary]:不同状态对应属性 40 | @brief Dictionary:状态包含["normal", "highlighted", "disabled", "selected"] 41 | 状态对应值也为 Dictionary 42 | @example 43 | "titleTextAttributes":{ 44 | "normal": 45 | { 46 | "NSForegroundColorAttributeName":"redColor", 47 | "NSFontAttributeName":{"size":14,"name":"bold"} 48 | }, 49 | "selected": 50 | { 51 | "NSForegroundColorAttributeName":"greenColor", 52 | "NSFontAttributeName":15 53 | } 54 | } 55 | @todo 现在只解析了 NSForegroundColorAttributeName, NSFontAttributeName, 待有时间再添加 56 | */ 57 | DefineParseFun(titleTextAttributes); 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UISegmentedControl+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControl+SkinParser.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/8/15. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UISegmentedControl+SkinParser.h" 10 | 11 | @interface UIControl() 12 | - (UIControlState)valueOfUIControlState:(NSString*)stateStr; 13 | @end 14 | 15 | @implementation UISegmentedControl(SkinParser) 16 | 17 | DefineParseFun(titles) 18 | { 19 | NSArray* titleArray = (NSArray*)value; 20 | NSUInteger count = titleArray.count; 21 | for(NSUInteger i=0; i 13 | #import "UIView+SkinParser.h" 14 | 15 | @interface UITableViewCell(SkinParser) 16 | 17 | /* 18 | @key[String]:accessoryType 19 | @value[String]:[none | disclosureIndicator | detailDisclosureButton | checkmark | DetailButton] 20 | @brief 详见系统 UITableViewCellAccessoryType 枚举 21 | @example "accessoryType":"checkmark" 22 | */ 23 | DefineParseFun(accessoryType); 24 | 25 | /* 26 | @key[String]:addSubview 27 | @value[Array]: subviews 28 | @brief 将子view 添加到 self.contentView上 29 | @example "addSubview":[{"class":"UIView"},{"class":"UIView"}] 30 | */ 31 | DefineParseFun(addSubview); 32 | 33 | /* 34 | @key[String]:selectionStyle 35 | @value[String]:[none | blue | gray | default] 36 | @brief 详见系统 UITableViewCellSelectionStyle 枚举 37 | @example "selectionStyle":"blue" 38 | */ 39 | DefineParseFun(selectionStyle); 40 | 41 | @end 42 | 43 | #endif //__UITABLEVIEWCELL_SKINPARSER_H__ 44 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/UITableViewCell+SkinParser.mm: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+SkinParser.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/17. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "UITableViewCell+SkinParser.h" 10 | 11 | @implementation UITableViewCell(SkinParser) 12 | 13 | - (UITableViewCellAccessoryType)valueOfUITableViewCellSeparatorStyle:(NSString*)type 14 | { 15 | NSArray* typeStrArray = @[@"none", @"disclosureIndicator", @"detailDisclosureButton",@"checkmark", @"DetailButton"]; 16 | for(NSInteger i=0; i 13 | 14 | @class ViewLayoutDes; 15 | @class BaseLayouter; 16 | 17 | @interface UIView(UIView_Layout) 18 | 19 | /** 20 | @brief 设置布局描述 21 | */ 22 | - (void)setViewLayoutDes:(ViewLayoutDes*)viewLayoutDes; 23 | 24 | /** 25 | @brief 获取布局描述对象 26 | */ 27 | - (ViewLayoutDes*)getViewLayoutDes; 28 | 29 | /** 30 | @brief 获取布局器 31 | */ 32 | - (BaseLayouter*)getLayouter; 33 | 34 | /** 35 | @brief 获取布局描述对象, 没有就创建 36 | */ 37 | - (ViewLayoutDes*)createViewLayoutDesIfNil; 38 | 39 | @end 40 | 41 | @interface UIView(SPAutoLayout) 42 | 43 | /** 44 | @brief 重新布局当前view的 subviews. 因此修改某view,应该当调用该view的superview些方法 45 | 在修改了控件某属性后,需要调用该控件, 46 | 对于cell, 则通过重写 layoutSubviews来自动调用该方法 47 | */ 48 | - (void)spUpdateLayout; 49 | 50 | /** 51 | @param 布局深度 52 | @brief 重新布局当前view的 subviews. 因此修改某view,应该当调用该view的superview些方法 53 | 在修改了控件某属性后,需要调用该控件, 54 | 对于cell, 则通过重写 layoutSubviews来自动调用该方法 55 | */ 56 | - (void)spUpdateLayout:(NSInteger)level; 57 | 58 | /** 59 | @brief 自动计算宽度,需要提供最大宽度,会自动计算一个合理的宽度 60 | */ 61 | - (void)calcWidth : (CGFloat (^)())getMaxWidth; 62 | 63 | /** 64 | @brief 自动计算高度 65 | */ 66 | - (void)calcHeight; 67 | 68 | /** 69 | @brief 自动计算高度, 此函数仅能被继承,不能主动调用 70 | */ 71 | - (void)calcHeightInView; 72 | 73 | @end 74 | 75 | #endif //__UIVIEW_LAYOUT_H__ 76 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/ViewLayoutDes.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewLayoutDes.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __VIEWLAYOUTDES_H__ 10 | #define __VIEWLAYOUTDES_H__ 11 | 12 | #import 13 | 14 | #import "LayoutTypeDef.h" 15 | 16 | @class BaseLayouter; 17 | 18 | @interface ViewLayoutDes : NSObject 19 | 20 | @property (nonatomic, strong) BaseLayouter* __nullable layouter; 21 | 22 | - (void)setStyleType:(NSInteger)index type:(LayoutType)type; 23 | 24 | - (void)setStyleAlign:(NSInteger)index type:(AlignType)type; 25 | 26 | - (void)setLeft:(NSInteger)index value:(CGFloat)value; 27 | 28 | - (void)setCenter:(NSInteger)index value:(CGFloat)value; 29 | 30 | - (void)setRight:(NSInteger)index value:(CGFloat)value; 31 | 32 | - (void)setTop:(NSInteger)index value:(CGFloat)value; 33 | 34 | - (void)setMiddle:(NSInteger)index value:(CGFloat)value; 35 | 36 | - (void)setBottom:(NSInteger)index value:(CGFloat)value; 37 | 38 | - (void)setWidth:(NSInteger)index value:(CGFloat)value; 39 | 40 | - (void)setHeight:(NSInteger)index value:(CGFloat)value; 41 | 42 | - (void)setStyleType:(LayoutType)type forTag:(NSInteger)tag; 43 | 44 | - (void)setStyleAlign:(AlignType)type forTag:(NSInteger)tag; 45 | 46 | - (void)setLeft:(CGFloat)value forTag:(NSInteger)tag; 47 | 48 | - (void)setCenter:(CGFloat)value forTag:(NSInteger)tag; 49 | 50 | - (void)setRight:(CGFloat)value forTag:(NSInteger)tag; 51 | 52 | - (void)setTop:(CGFloat)value forTag:(NSInteger)tag; 53 | 54 | - (void)setMiddle:(CGFloat)value forTag:(NSInteger)tag; 55 | 56 | - (void)setBottom:(CGFloat)value forTag:(NSInteger)tag; 57 | 58 | - (void)setWidth:(CGFloat)value forTag:(NSInteger)tag; 59 | 60 | - (void)setHeight:(CGFloat)value forTag:(NSInteger)tag; 61 | 62 | - (void)setTag:(NSInteger)tag; 63 | 64 | - (void)setMaxSize:(CGSize)size; 65 | 66 | - (void)setMinSize:(CGSize)size; 67 | 68 | - (void)setConstraintMask:(NSInteger)constraintMask; 69 | 70 | - (LayoutType)styleType:(NSInteger)index; 71 | 72 | - (AlignType)styleAlign:(NSInteger)index; 73 | 74 | - (CGFloat)left:(NSInteger)index; 75 | 76 | - (CGFloat)center:(NSInteger)index; 77 | 78 | - (CGFloat)right:(NSInteger)index; 79 | 80 | - (CGFloat)top:(NSInteger)index; 81 | 82 | - (CGFloat)middle:(NSInteger)index; 83 | 84 | - (CGFloat)bottom:(NSInteger)index; 85 | 86 | - (CGFloat)width:(NSInteger)index; 87 | 88 | - (CGFloat)height:(NSInteger)index; 89 | 90 | - (LayoutType)styleTypeByTag:(NSInteger)aTag; 91 | 92 | - (AlignType)styleAlignByTag:(NSInteger)aTag; 93 | 94 | - (CGFloat)leftByTag:(NSInteger)aTag; 95 | 96 | - (CGFloat)centerByTag:(NSInteger)aTag; 97 | 98 | - (CGFloat)rightByTag:(NSInteger)aTag; 99 | 100 | - (CGFloat)topByTag:(NSInteger)aTag; 101 | 102 | - (CGFloat)middleByTag:(NSInteger)aTag; 103 | 104 | - (CGFloat)bottomByTag:(NSInteger)aTag; 105 | 106 | - (NSInteger)tag; 107 | 108 | - (CGSize)maxSize; 109 | 110 | - (CGSize)minSize; 111 | 112 | - (NSInteger)constraintMask; 113 | 114 | @end 115 | 116 | #endif //__VIEWLAYOUTDES_H__ 117 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/ViewLayoutDes.mm: -------------------------------------------------------------------------------- 1 | // 2 | // ViewLayoutDes.mm 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/9. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #import "ViewLayoutDes.h" 10 | 11 | @implementation ViewLayoutDes 12 | 13 | - (void)setStyleType:(NSInteger)index type:(LayoutType)type 14 | { 15 | 16 | } 17 | 18 | 19 | - (void)setStyleAlign:(NSInteger)index type:(AlignType)type 20 | { 21 | 22 | } 23 | 24 | #define SetConstraint(__ori, __orikey)\ 25 | do\ 26 | {\ 27 | BOOL isNil = YES;\ 28 | for(NSInteger i = 0; i< (sizeof(style) / sizeof(style[0])); ++i)\ 29 | {\ 30 | if(style[i].__orikey < NILV)\ 31 | {\ 32 | isNil = NO;\ 33 | break;\ 34 | }\ 35 | }\ 36 | if(isNil)\ 37 | {\ 38 | constraintMask &= ~EConstraint##__ori;\ 39 | }\ 40 | else\ 41 | {\ 42 | constraintMask |= EConstraint##__ori;\ 43 | }\ 44 | }while(0) 45 | 46 | 47 | #define SETV(__ori)\ 48 | for(NSInteger index=0; index<2; ++index)\ 49 | {\ 50 | if( tag == style[index].asstag )\ 51 | {\ 52 | [self set##__ori:index value:value];\ 53 | break;\ 54 | }\ 55 | } 56 | 57 | #define SetValueByIndex(__ori, __orikey)\ 58 | - (void)set##__ori:(NSInteger)index value:(CGFloat)value\ 59 | {\ 60 | } 61 | 62 | #define SetValueByTag(__ori, __oriKey)\ 63 | - (void)set##__ori:(CGFloat)value forTag:(NSInteger)asstag\ 64 | {\ 65 | } 66 | 67 | #define SetPairValue(__ori, __orikey)\ 68 | SetValueByIndex(__ori, __orikey)\ 69 | SetValueByTag(__ori, __orikey) 70 | 71 | SetPairValue(Left, left) 72 | SetPairValue(Center, center) 73 | SetPairValue(Right, right) 74 | SetPairValue(Top, top) 75 | SetPairValue(Middle, middle) 76 | SetPairValue(Bottom, bottom) 77 | SetPairValue(Width, width) 78 | SetPairValue(Height, height) 79 | 80 | #undef SETV 81 | 82 | #define SETV(__x)\ 83 | for(NSInteger index=0; index<2; ++index)\ 84 | {\ 85 | if( tag == style[index].asstag )\ 86 | {\ 87 | (__x);\ 88 | break;\ 89 | }\ 90 | } 91 | 92 | - (void)setStyleType:(LayoutType)type forTag:(NSInteger)asstag 93 | { 94 | 95 | } 96 | 97 | - (void)setStyleAlign:(AlignType)type forTag:(NSInteger)asstag 98 | { 99 | 100 | } 101 | 102 | #undef SETV 103 | 104 | - (void)setTag:(NSInteger)aTag 105 | { 106 | 107 | } 108 | 109 | - (void)setMaxSize:(CGSize)size 110 | { 111 | 112 | } 113 | 114 | - (void)setMinSize:(CGSize)size 115 | { 116 | 117 | } 118 | 119 | - (void)setConstraintMask:(NSInteger)mask 120 | { 121 | 122 | } 123 | 124 | - (LayoutType)styleType:(NSInteger)index 125 | { 126 | return ELayoutNone; 127 | } 128 | 129 | - (AlignType)styleAlign:(NSInteger)index 130 | { 131 | return EAlignNone; 132 | } 133 | 134 | - (CGFloat)left:(NSInteger)index 135 | { 136 | return 0; 137 | } 138 | 139 | - (CGFloat)center:(NSInteger)index 140 | { 141 | return 0; 142 | } 143 | 144 | - (CGFloat)right:(NSInteger)index 145 | { 146 | return 0; 147 | } 148 | 149 | - (CGFloat)top:(NSInteger)index 150 | { 151 | return 0; 152 | } 153 | 154 | - (CGFloat)middle:(NSInteger)index 155 | { 156 | return 0; 157 | } 158 | 159 | - (CGFloat)bottom:(NSInteger)index 160 | { 161 | return 0; 162 | } 163 | 164 | - (CGFloat)width:(NSInteger)index 165 | { 166 | return 0; 167 | } 168 | 169 | - (CGFloat)height:(NSInteger)index 170 | { 171 | return 0; 172 | } 173 | 174 | - (LayoutType)styleTypeByTag:(NSInteger)aTag 175 | { 176 | return ELayoutNone; 177 | } 178 | 179 | - (AlignType)styleAlignByTag:(NSInteger)aTag 180 | { 181 | return EAlignNone; 182 | } 183 | 184 | - (CGFloat)leftByTag:(NSInteger)aTag 185 | { 186 | return NILV; 187 | } 188 | 189 | - (CGFloat)centerByTag:(NSInteger)aTag 190 | { 191 | return NILV; 192 | } 193 | 194 | - (CGFloat)rightByTag:(NSInteger)aTag 195 | { 196 | return NILV; 197 | } 198 | 199 | - (CGFloat)topByTag:(NSInteger)aTag 200 | { 201 | return NILV; 202 | } 203 | 204 | - (CGFloat)middleByTag:(NSInteger)aTag 205 | { 206 | return NILV; 207 | } 208 | 209 | - (CGFloat)bottomByTag:(NSInteger)aTag 210 | { 211 | return NILV; 212 | } 213 | 214 | - (CGFloat)widthByTag:(NSInteger)aTag 215 | { 216 | return NILV; 217 | } 218 | 219 | - (CGFloat)heightByTag:(NSInteger)aTag 220 | { 221 | return NILV; 222 | } 223 | 224 | - (NSInteger)tag 225 | { 226 | return 0; 227 | } 228 | 229 | - (CGSize)maxSize 230 | { 231 | return CGSizeZero; 232 | } 233 | 234 | - (CGSize)minSize 235 | { 236 | return CGSizeZero; 237 | } 238 | 239 | - (NSInteger)constraintMask 240 | { 241 | return 0; 242 | } 243 | 244 | @end 245 | -------------------------------------------------------------------------------- /EALayout/EALayout/SkinParser/ViewLayoutDesImp.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewLayoutDesImp.h 3 | // EALayout 4 | // 5 | // Created by easycoding on 15/7/18. 6 | // Copyright (c) 2015年 www.easycoding.top. All rights reserved. 7 | // 8 | 9 | #ifndef __VIEWLAYOUTDESIMP_H__ 10 | #define __VIEWLAYOUTDESIMP_H__ 11 | 12 | #import 13 | 14 | @interface ViewLayoutDesImp : ViewLayoutDes 15 | { 16 | @public 17 | LayoutStyle style[2]; 18 | NSInteger tag; 19 | CGSize maxSize; 20 | CGSize minSize; 21 | NSInteger constraintMask; 22 | BOOL zeroRectWhenHidden; 23 | NSInteger calcOnlyOneTimeMask; 24 | } 25 | 26 | #ifdef __cplusplus 27 | #define calcByOri(__ori) \ 28 | + (CGFloat) calc_##__ori:(LayoutStyle&)__style fetchRect:( CGRect* (^)(RefView) ) fetchViewRect; 29 | 30 | calcByOri(left) 31 | calcByOri(top) 32 | calcByOri(right) 33 | calcByOri(bottom) 34 | calcByOri(width) 35 | calcByOri(height) 36 | calcByOri(center) 37 | calcByOri(middle) 38 | 39 | #undef calcByOri 40 | 41 | #endif 42 | 43 | @end 44 | 45 | @interface UIView(getViewLayoutDesImp) 46 | 47 | - (ViewLayoutDesImp*)getViewLayoutDesImp; 48 | 49 | @end 50 | 51 | #endif //__VIEWLAYOUTDESIMP_H__ 52 | -------------------------------------------------------------------------------- /EALayout/Extension/EADebugWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // EADebugWindow.h 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | // 此文件只是用于DEBUG,主要是用来控制实时刷新的开关操作。 9 | 10 | #if DEBUG 11 | 12 | #ifndef EALayoutLiteForOC_EADebugWindow_h 13 | #define EALayoutLiteForOC_EADebugWindow_h 14 | 15 | #import 16 | 17 | @interface EADebugWindow : UIWindow 18 | 19 | + (instancetype)createDebugWindow; 20 | 21 | - (void)setSkinPath:(NSString*)relativePath absolutePath:(NSString*)absolutePath; 22 | 23 | @end 24 | 25 | #endif //EALayoutLiteForOC_EADebugWindow_h 26 | 27 | #endif //DEBUG 28 | 29 | 30 | /*usage:*/ 31 | /* 32 | - (void)enableSkinDebug 33 | { 34 | #if DEBUG 35 | //DEBUG状态下,创建一个控制条在界面顶部,用于开启自动刷新界面的功能,以便实时看到效果 36 | EADebugWindow* debugWin = [EADebugWindow createDebugWindow]; 37 | debugWin.hidden = NO; 38 | 39 | #if TARGET_IPHONE_SIMULATOR 40 | //些处的设置为 资源文件在系统文件夹目录相对于当前文件的相对目录,此处 AppDelegate.m 与 Resources 同级了 41 | [debugWin setSkinPath:@"Resources" absolutePath:[@(__FILE__) stringByDeletingLastPathComponent]]; 42 | #endif 43 | 44 | #endif 45 | 46 | } 47 | */ 48 | -------------------------------------------------------------------------------- /EALayout/Extension/EADebugWindow.mm: -------------------------------------------------------------------------------- 1 | 2 | // 此文件只是用于DEBUG,主要是用来控制实时刷新的开关操作。 3 | 4 | #if DEBUG 5 | 6 | #import "EADebugWindow.h" 7 | #import "EAViewController.h" 8 | 9 | @implementation EADebugWindow 10 | { 11 | NSTimer* timer; 12 | BOOL _debugSkin; 13 | } 14 | 15 | + (instancetype)createDebugWindow 16 | { 17 | static dispatch_once_t pred = 0; 18 | static EADebugWindow *debugWindow = nil; 19 | dispatch_once(&pred, ^{ 20 | debugWindow = [[EADebugWindow alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20)]; 21 | }); 22 | return debugWindow; 23 | } 24 | 25 | - (void)setSkinPath:(NSString*)relativePath absolutePath:(NSString*)absolutePath 26 | { 27 | NSString* skinPath = [absolutePath stringByAppendingPathComponent:relativePath]; 28 | [SkinMgr sharedInstance].rootPath = skinPath; 29 | } 30 | 31 | - (id)initWithFrame:(CGRect)frame 32 | { 33 | if (self = [super initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20)]) 34 | { 35 | UIViewController* vc = [UIViewController new]; 36 | self.rootViewController = vc; 37 | 38 | UIButton* button = [[UIButton alloc] initWithFrame:self.bounds]; 39 | [button addTarget:self action:@selector(switchSkinDebug:) forControlEvents:UIControlEventTouchUpInside]; 40 | [vc.view addSubview:button]; 41 | button.tag = 8001; 42 | [button setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)]; 43 | self.userInteractionEnabled = true; 44 | self.windowLevel = 2000; 45 | 46 | UIButton* button1 = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 20)]; 47 | [button1 setTitle:@"自动刷新" forState:(UIControlStateNormal)]; 48 | [button1 setTitle:@"关闭刷新" forState:(UIControlStateSelected)]; 49 | [button1 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)]; 50 | [button1 addTarget:self action:@selector(switchRefresh:) forControlEvents:UIControlEventTouchUpInside]; 51 | button1.backgroundColor = [UIColor greenColor]; 52 | [button addSubview:button1]; 53 | button1.hidden = true; 54 | button1.tag = 81001; 55 | 56 | UIButton* button2 = [[UIButton alloc] initWithFrame:CGRectMake(80, 0, 80, 20)]; 57 | [button2 setTitle:@"刷一下" forState:(UIControlStateNormal)]; 58 | [button2 addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventTouchUpInside]; 59 | button2.backgroundColor = [UIColor blueColor]; 60 | [button2 setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)]; 61 | [button addSubview:button2]; 62 | button2.hidden = true; 63 | button2.tag = 81002; 64 | 65 | UILabel* label = [[UILabel alloc] initWithFrame:self.bounds]; 66 | [vc.view addSubview:label]; 67 | label.textColor = [UIColor blackColor]; 68 | label.text = @"1"; 69 | label.tag = 7001; 70 | label.hidden = YES; 71 | label.textAlignment = NSTextAlignmentRight; 72 | timer = nil; 73 | button.selected = YES; 74 | [self switchSkinDebug:button]; 75 | } 76 | return self; 77 | } 78 | 79 | - (void)switchRefresh:(UIButton*)button 80 | { 81 | button.selected = !button.selected; 82 | if(button.selected) { 83 | _debugSkin = YES; 84 | [self autoRefresh]; 85 | [self viewWithTag:81002].hidden = YES; 86 | } else { 87 | _debugSkin = NO; 88 | [self autoRefresh]; 89 | [self viewWithTag:81002].hidden = NO; 90 | } 91 | } 92 | 93 | - (void)refresh:(UIButton*)button 94 | { 95 | button.selected = !button.selected; 96 | _debugSkin = button.selected; 97 | [self tick]; 98 | UILabel* label = (UILabel*)[self viewWithTag:7001]; 99 | NSInteger value = label.text.integerValue + 1; 100 | label.text = @(value).stringValue; 101 | } 102 | 103 | - (void)switchSkinDebug:(UIButton*)button 104 | { 105 | button.selected = !button.selected; 106 | if(button.selected) 107 | { 108 | self.backgroundColor = [UIColor yellowColor]; 109 | [button viewWithTag:81001].hidden = NO; 110 | [button viewWithTag:81002].hidden = NO; 111 | [self viewWithTag:7001].hidden = NO; 112 | } 113 | else 114 | { 115 | self.backgroundColor = nil; 116 | [button viewWithTag:81001].hidden = YES; 117 | [button viewWithTag:81002].hidden = YES; 118 | ((UIButton*)[button viewWithTag:81001]).selected = NO; 119 | [self viewWithTag:7001].hidden = YES; 120 | } 121 | _debugSkin = NO; 122 | [self autoRefresh]; 123 | } 124 | 125 | - (void)autoRefresh 126 | { 127 | if ( _debugSkin ) 128 | { 129 | if (nil == timer) 130 | { 131 | NSTimeInterval ds = 1; 132 | timer = [NSTimer scheduledTimerWithTimeInterval:ds target:self selector:@selector(tick) userInfo:nil repeats:YES]; 133 | } 134 | } 135 | else 136 | { 137 | [timer invalidate]; 138 | timer = nil; 139 | } 140 | } 141 | 142 | - (void)tick 143 | { 144 | if ( _debugSkin ) 145 | { 146 | UIViewController* rootVC = [[UIApplication sharedApplication].windows[0] rootViewController]; 147 | if( [rootVC isKindOfClass:[UINavigationController class]]) 148 | { 149 | [[((UINavigationController*)rootVC) topViewController] performSelector:@selector(freshSkin)]; 150 | } 151 | else 152 | { 153 | [rootVC performSelector:@selector(freshSkin)]; 154 | } 155 | } 156 | } 157 | 158 | @end 159 | 160 | #endif //DEBUG 161 | 162 | -------------------------------------------------------------------------------- /EALayout/Extension/EATableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // EATableViewCell.h 3 | // EALayoutLite 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EATableViewCell : UITableViewCell 12 | 13 | @end 14 | 15 | 16 | @interface UITableViewCell (Layout) 17 | - (CGFloat)autoCalcHeight:(UITableView*) tableView; 18 | @end 19 | -------------------------------------------------------------------------------- /EALayout/Extension/EATableViewCell.mm: -------------------------------------------------------------------------------- 1 | // 2 | // EATableViewCell.m 3 | // EALayoutLite 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import "EATableViewCell.h" 10 | #import 11 | 12 | @implementation EATableViewCell 13 | 14 | - (void)layoutSubviews 15 | { 16 | [super layoutSubviews]; 17 | 18 | //Tableview在计算完 cell的frame后,会调用此函数进行布局 19 | //添加此行是为了 在系统调用了布局后,可以进行EALayout的布局功能 20 | if(![self applyCacheLayout])//如果读取到缓存frame信息,就不会调用 spUpdateLayout 21 | { 22 | [self spUpdateLayout]; 23 | [self setNeedCacheLayout]; 24 | } 25 | } 26 | 27 | @end 28 | 29 | @implementation UITableViewCell(Layout) 30 | 31 | - (CGFloat)autoCalcHeight:(UITableView*) tableView 32 | { 33 | CGRect frame = self.frame; 34 | frame.size.width = tableView.frame.size.width; 35 | self.frame = frame; 36 | [self spUpdateLayout]; 37 | [self calcHeight]; 38 | return self.frame.size.height; 39 | } 40 | 41 | @end 42 | 43 | -------------------------------------------------------------------------------- /EALayout/Extension/EAViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EAViewController.h 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #ifndef EALayoutLiteForOC_EAViewController_h 10 | #define EALayoutLiteForOC_EAViewController_h 11 | 12 | #import "EALayout.h" 13 | 14 | typedef enum UpdateTitleMask { 15 | EUpdateTitle = 1, 16 | EUpdateLeft = 1<<1, 17 | EUpdateMiddle = 1<<2, 18 | EUpdateRight = 1<<3, 19 | EUpdateBg = 1<<4, 20 | EUpdateAll = EUpdateTitle | EUpdateLeft | EUpdateMiddle | EUpdateRight | EUpdateBg 21 | 22 | } UpdateTitleMask; 23 | 24 | @interface EAViewController : UIViewController 25 | 26 | /* 27 | */ 28 | @property (nonatomic, copy) NSString* skinFileName; 29 | @property (nonatomic, strong) SkinParser* skinParser; 30 | 31 | @property (nonatomic, strong) UIView* titleBgView; 32 | @property (nonatomic, strong) UIView* titleLeftView; 33 | @property (nonatomic, strong) UIView* titleMiddleView; 34 | @property (nonatomic, strong) UIView* titleRightView; 35 | 36 | @property (nonatomic, strong) UIView* topLayoutView; 37 | @property (nonatomic, strong) UIView* contentHeaderLayoutView; 38 | @property (nonatomic, strong) UIView* contentLayoutView; 39 | @property (nonatomic, strong) UIView* bottomLayoutView; 40 | 41 | - (void) freshSkin; 42 | 43 | @property (nonatomic, strong)UITableView* tableView; 44 | 45 | - (void)resetTableHeaderView:(UIView*)tableHeaderView; 46 | 47 | - (UITableViewCell*)createCell:(NSString*)identifier; 48 | 49 | - (UITableViewCell*)createCell:(NSString*)identifier created:(void (^)(UITableViewCell* cell)) created; 50 | 51 | - (UITableViewCell*)createCacheCell:(NSString*)identifier; 52 | 53 | - (void)layoutSelfView; 54 | 55 | - (void)updateTitleView; 56 | 57 | - (void)titleBackClick; 58 | 59 | - (UIView*)createTitleBgView; 60 | 61 | - (UIView*)createTitleLeftView; 62 | 63 | - (UIView*)createTitleMiddleView; 64 | 65 | - (UIView*)createTitleRightView; 66 | 67 | @end 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /EALayout/Extension/Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // Extension.h 3 | // EALayout 4 | // 5 | // Created by splendourbell on 16/8/9. 6 | // Copyright © 2016年 easylayout. All rights reserved. 7 | // 8 | 9 | #ifndef Extension_h 10 | #define Extension_h 11 | 12 | #import "EADebugWindow.h" 13 | #import "EATableViewCell.h" 14 | #import "EAViewController.h" 15 | #import "UIView+binddata.h" 16 | 17 | #endif /* Extension_h */ 18 | -------------------------------------------------------------------------------- /EALayout/Extension/UIView+binddata.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /********************** 绑定基本数据到对象 *********************************/ 5 | 6 | //MARK: 绑定view最常用数据 UIView(bindData) 7 | #import 8 | 9 | @interface UIView(bindData) 10 | 11 | - (void)bindData:(id)data; 12 | 13 | - (void)bindForUILabel:(id)data; 14 | 15 | - (void)bindForUIImageView:(id)data; 16 | 17 | - (void)bindForUIButton:(id)data; 18 | 19 | - (__kindof UIView *)bindByTag:(NSInteger)tag data:(id)data; 20 | 21 | - (__kindof UIView *)bindByStrTag:(NSString*)tag data:(id)data; 22 | 23 | @end 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /EALayout/Extension/UIView+binddata.mm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /********************** 绑定基本数据到对象 *********************************/ 5 | 6 | //MARK: 绑定view最常用数据 UIView(bindData) 7 | 8 | #import "UIView+binddata.h" 9 | #import "EALayout.h" 10 | 11 | @implementation UIView(bindData) 12 | 13 | 14 | - (void)bindData:(id)data 15 | { 16 | if( [self isKindOfClass:[UILabel class]] ) 17 | { 18 | [self bindForUILabel:data]; 19 | } 20 | else if( [self isKindOfClass:[UIImageView class]] ) 21 | { 22 | [self bindForUIImageView:data]; 23 | } 24 | else if( [self isKindOfClass:[UIButton class]] ) 25 | { 26 | [self bindForUIButton:data]; 27 | } 28 | } 29 | 30 | - (void)bindForUILabel:(id)data 31 | { 32 | data = data ?: @""; 33 | if ( [data isKindOfClass:[NSString class]] ) 34 | { 35 | [(UILabel*)self setText:(NSString*)data]; 36 | } 37 | } 38 | 39 | - (void)bindForUIImageView:(id)data 40 | { 41 | if (!data || [data isKindOfClass:[UIImage class]] ) 42 | { 43 | [(UIImageView*)self setImage:(UIImage*)data]; 44 | } 45 | } 46 | 47 | - (void)bindForUIButton:(id)data 48 | { 49 | if( [data isKindOfClass:[NSString class]] ) 50 | { 51 | [(UIButton*)self setTitle:(NSString*)data forState:UIControlStateNormal]; 52 | } 53 | else if(!data || [data isKindOfClass:[UIImage class]] ) 54 | { 55 | [(UIButton*)self setImage:(UIImage*)data forState:UIControlStateNormal]; 56 | } 57 | } 58 | 59 | - (UIView*)bindByTag:(NSInteger)tag data:(id)data 60 | { 61 | UIView* subView = [self viewWithTag:tag]; 62 | [subView bindData:data]; 63 | return subView; 64 | } 65 | 66 | - (UIView*)bindByStrTag:(NSString*)tag data:(id)data 67 | { 68 | UIView* subView = [self viewWithStrTag:tag]; 69 | [subView bindData:data]; 70 | return subView; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /EALayoutLiteForOC.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EALayoutLiteForOC.xcodeproj/project.xcworkspace/xcshareddata/EALayoutLiteForOC.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E" : 0, 8 | "EB3D3B4B9575B6717E993164BA29804CF9EDF0BE" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "772D70F4-F176-4483-936E-6DF2655D6F21", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E" : "EALayoutLiteForOC\/", 13 | "EB3D3B4B9575B6717E993164BA29804CF9EDF0BE" : "EALayoutLite\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "EALayoutLiteForOC", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "EALayoutLiteForOC.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/easycodingTop\/EALayoutLiteForOC.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "92C34EA6A5E0B1E80496BF8F35904F1C07DCF73E" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/easycodingTop\/EALayout.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "EB3D3B4B9575B6717E993164BA29804CF9EDF0BE" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /EALayoutLiteForOC/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | [SkinMgr sharedInstance].rootPath = [NSBundle mainBundle].resourcePath; 18 | 19 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 20 | self.window.rootViewController = [[ViewController alloc] initWithNibName:nil bundle:nil]; 21 | [self.window makeKeyAndVisible]; 22 | 23 | [self enableSkinDebug]; 24 | return YES; 25 | } 26 | 27 | - (void)enableSkinDebug 28 | { 29 | #if DEBUG 30 | //DEBUG状态下,创建一个控制条在界面顶部,用于开启自动刷新界面的功能,以便实时看到效果 31 | EADebugWindow* debugWin = [EADebugWindow createDebugWindow]; 32 | debugWin.hidden = NO; 33 | 34 | #if TARGET_IPHONE_SIMULATOR 35 | //些处的设置为 资源文件在系统文件夹目录相对于当前文件的相对目录,此处 AppDelegate.m 与 Resources 同级了 36 | [debugWin setSkinPath:@"Resources" absolutePath:[@(__FILE__) stringByDeletingLastPathComponent]]; 37 | #endif 38 | 39 | #endif 40 | 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/EALayoutLiteForOC.pch: -------------------------------------------------------------------------------- 1 | // 2 | // EALayoutLiteForOC.pch 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #ifndef EALayoutLiteForOC_EALayoutLiteForOC_pch 10 | #define EALayoutLiteForOC_EALayoutLiteForOC_pch 11 | 12 | #ifdef __OBJC__ 13 | 14 | #import 15 | 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/1242x2208@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/1242x2208@3x.png -------------------------------------------------------------------------------- /EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/640x1136@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/640x1136@2x.png -------------------------------------------------------------------------------- /EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/640x960@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/640x960@2x.png -------------------------------------------------------------------------------- /EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/750x1334@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/750x1334@2x.png -------------------------------------------------------------------------------- /EALayoutLiteForOC/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "1242x2208@3x.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "orientation" : "landscape", 14 | "idiom" : "iphone", 15 | "extent" : "full-screen", 16 | "minimum-system-version" : "8.0", 17 | "subtype" : "736h", 18 | "scale" : "3x" 19 | }, 20 | { 21 | "extent" : "full-screen", 22 | "idiom" : "iphone", 23 | "subtype" : "667h", 24 | "filename" : "750x1334@2x.png", 25 | "minimum-system-version" : "8.0", 26 | "orientation" : "portrait", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "orientation" : "portrait", 31 | "idiom" : "iphone", 32 | "extent" : "full-screen", 33 | "minimum-system-version" : "7.0", 34 | "filename" : "640x960@2x.png", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "extent" : "full-screen", 39 | "idiom" : "iphone", 40 | "subtype" : "retina4", 41 | "filename" : "640x1136@2x.png", 42 | "minimum-system-version" : "7.0", 43 | "orientation" : "portrait", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "orientation" : "portrait", 48 | "idiom" : "ipad", 49 | "extent" : "full-screen", 50 | "minimum-system-version" : "7.0", 51 | "scale" : "1x" 52 | }, 53 | { 54 | "orientation" : "landscape", 55 | "idiom" : "ipad", 56 | "extent" : "full-screen", 57 | "minimum-system-version" : "7.0", 58 | "scale" : "1x" 59 | }, 60 | { 61 | "orientation" : "portrait", 62 | "idiom" : "ipad", 63 | "extent" : "full-screen", 64 | "minimum-system-version" : "7.0", 65 | "scale" : "2x" 66 | }, 67 | { 68 | "orientation" : "landscape", 69 | "idiom" : "ipad", 70 | "extent" : "full-screen", 71 | "minimum-system-version" : "7.0", 72 | "scale" : "2x" 73 | }, 74 | { 75 | "orientation" : "portrait", 76 | "idiom" : "iphone", 77 | "extent" : "full-screen", 78 | "scale" : "1x" 79 | }, 80 | { 81 | "orientation" : "portrait", 82 | "idiom" : "iphone", 83 | "extent" : "full-screen", 84 | "scale" : "2x" 85 | }, 86 | { 87 | "orientation" : "portrait", 88 | "idiom" : "iphone", 89 | "extent" : "full-screen", 90 | "subtype" : "retina4", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "ipad", 96 | "extent" : "to-status-bar", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "orientation" : "portrait", 101 | "idiom" : "ipad", 102 | "extent" : "full-screen", 103 | "scale" : "1x" 104 | }, 105 | { 106 | "orientation" : "landscape", 107 | "idiom" : "ipad", 108 | "extent" : "to-status-bar", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "orientation" : "landscape", 113 | "idiom" : "ipad", 114 | "extent" : "full-screen", 115 | "scale" : "1x" 116 | }, 117 | { 118 | "orientation" : "portrait", 119 | "idiom" : "ipad", 120 | "extent" : "to-status-bar", 121 | "scale" : "2x" 122 | }, 123 | { 124 | "orientation" : "portrait", 125 | "idiom" : "ipad", 126 | "extent" : "full-screen", 127 | "scale" : "2x" 128 | }, 129 | { 130 | "orientation" : "landscape", 131 | "idiom" : "ipad", 132 | "extent" : "to-status-bar", 133 | "scale" : "2x" 134 | }, 135 | { 136 | "orientation" : "landscape", 137 | "idiom" : "ipad", 138 | "extent" : "full-screen", 139 | "scale" : "2x" 140 | } 141 | ], 142 | "info" : { 143 | "version" : 1, 144 | "author" : "xcode" 145 | } 146 | } -------------------------------------------------------------------------------- /EALayoutLiteForOC/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UIRequiredDeviceCapabilities 31 | 32 | armv7 33 | 34 | UIRequiresFullScreen 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | 40 | UIViewControllerBasedStatusBarAppearance 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/Resources/1024x682@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/EALayoutLiteForOC/Resources/1024x682@2x.jpg -------------------------------------------------------------------------------- /EALayoutLiteForOC/Resources/common.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "tableView": 4 | { 5 | "class":"UITableView", 6 | "layout":{"s":"l,r,b"}, 7 | "showsHorizontalScrollIndicator":0, 8 | "showsVerticalScrollIndicator":0, 9 | "backgroundColor":"clearColor", 10 | "separatorStyle":"none" 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/Resources/style.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "fontStyle":{ 4 | "font":18 5 | }, 6 | 7 | "greenStyle":{ 8 | "textColor":"greenColor", 9 | }, 10 | "blueBackStyle":{ 11 | "backgroundColor":"blueColor" 12 | }, 13 | "redBackStyle":{ 14 | "backgroundColor":"redColor" 15 | } 16 | } -------------------------------------------------------------------------------- /EALayoutLiteForOC/Resources/testicon@2x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/EALayoutLiteForOC/Resources/testicon@2x.jpg -------------------------------------------------------------------------------- /EALayoutLiteForOC/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ViewController : EAViewController 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/ViewController.mm: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 18 | { 19 | return 10; 20 | } 21 | 22 | - (NSString*)getText:(NSInteger)row 23 | { 24 | switch (row % 5) 25 | { 26 | case 0: 27 | return @"这是一行文字"; 28 | case 1: 29 | return @"这里是两行文字\n两行"; 30 | case 2: 31 | return @"这里三行文字\n第二行\n第三行"; 32 | case 3: 33 | return @"不知道会是多少行,手机屏幕宽度不同可能行数不同"; 34 | case 4: 35 | return @"这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行,这里是大量的文字,但是只会显示前四行"; 36 | default: 37 | break; 38 | } 39 | return @""; 40 | } 41 | 42 | - (NSString*)getDataId:(NSInteger)row 43 | { 44 | return @(row).stringValue;//实际上应该为数据的key, 一个key对应一个一样的数据,对应一个一样的cell布局 45 | } 46 | 47 | - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 48 | { 49 | if (0 == indexPath.row) 50 | { 51 | UITableViewCell* cell = [self createCell:@"cell_1"]; 52 | [cell bindByStrTag:@"titleLabel" data:[NSString stringWithFormat:@"我是第%zd行Title", indexPath.row]]; 53 | [cell bindByTag:7002 data:[NSString stringWithFormat:@"我是第%zd行DetailText", indexPath.row]]; 54 | 55 | NSString* dataId = [self getDataId:indexPath.row]; 56 | [cell configCache:dataId host:tableView]; //dataId相同时,cell的所有view布局也将相同。此行目的是为了缓存布局,效率上优化。 57 | return cell; 58 | 59 | } 60 | else 61 | { 62 | UITableViewCell* cell = [self createCell:@"cell_2"]; 63 | [cell bindByStrTag:@"multLineText" data:[self getText:indexPath.row]]; 64 | [cell configCache:[self getDataId:indexPath.row] host:tableView]; 65 | return cell; 66 | } 67 | } 68 | 69 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 70 | { 71 | NSString* dataId = [self getDataId:indexPath.row]; 72 | return [[self cacheValue:dataId noCache:^id{ //dataId相同时,cell的高度将相同。相当于通过dataId缓存了计算的高度。 73 | if( 0 == indexPath.row ) 74 | { 75 | NSNumber* number = [self.skinParser valueWithName:@"cell_1" key:@"height"]; 76 | if(number) 77 | { 78 | return number; 79 | } 80 | else 81 | { 82 | UITableViewCell* cell = [self createCacheCell:@"cell_1"]; 83 | [cell bindByStrTag:@"titleLabel" data:[NSString stringWithFormat:@"我是第%zd行Title", indexPath.row]]; 84 | [cell bindByTag:7002 data:[NSString stringWithFormat:@"我是第%zd行DetailText", indexPath.row]]; 85 | CGRect frame = cell.frame; 86 | frame.size.width = tableView.frame.size.width; 87 | cell.frame = frame; 88 | [cell spUpdateLayout]; 89 | [cell calcHeight]; 90 | return @(cell.frame.size.height); 91 | } 92 | } 93 | else 94 | { 95 | 96 | UITableViewCell* cell = [self createCacheCell:@"cell_2"]; 97 | [cell bindByStrTag:@"multLineText" data:[self getText:indexPath.row]]; 98 | CGRect frame = cell.frame; 99 | frame.size.width = tableView.frame.size.width; 100 | cell.frame = frame; 101 | [cell spUpdateLayout]; 102 | [cell calcHeight]; 103 | return @(cell.frame.size.height); 104 | } 105 | }] floatValue]; 106 | } 107 | 108 | - (void)TabButtonAction:(UIButton*)button 109 | { 110 | for(int i=0;i<4;i++) 111 | { 112 | UIButton* otherButton = (UIButton*)[button.superview viewWithTag:8001+i]; 113 | otherButton.selected = false; 114 | [otherButton viewWithTag:1001].hidden = true; 115 | } 116 | button.selected = true; 117 | [button viewWithTag:1001].hidden = false; 118 | } 119 | 120 | - (void)AlterLabelText:(UIButton*)button 121 | { 122 | button.selected = !button.selected; 123 | UILabel* label = (UILabel*)[self.tableView.tableHeaderView viewWithStrTag:@"contentText"]; 124 | if(button.selected) 125 | { 126 | label.text = @"这里的文字是自动计算大小"; 127 | } 128 | else 129 | { 130 | label.text = @"这里的文字是自动计算大小, 并且父view也是可以根据文字自动计算大小,无需代码计算"; 131 | } 132 | [self resetTableHeaderView:self.tableView.tableHeaderView]; 133 | } 134 | 135 | @end 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /EALayoutLiteForOC/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EALayoutLiteForOC 4 | // 5 | // Created by easycoding on 15/7/21. 6 | // Copyright (c) 2015年 easycoding. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /README.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easycodingTop/EALayout/933799539e7fa224025ec4acba84520f81cec88f/README.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![image](https://github.com/easycodingTop/EALayoutLiteForOC/raw/master/README.gif) 2 | # EALayoutLiteForOC 3 | https://github.com/easycodingTop/EALayoutLiteForOC for Objective-C 4 | 5 | 一个实时可视化界面的框架 边写界面,可以实时预览,无需反复编译。 6 | 7 | 在引入框架时,记得加上 other linker Flags 设置为 -ObjC 8 | 9 | 请使用 xcode 6.4以上版本 10 | 11 | 将CodeSnippets 内容放在 ~/Library/Developer/Xcode/UserData/CodeSnippets 目录下,重启Xcode 这个是在json文件里,可以有自动提示,写json速度很快 12 | 也可以使用 ./installSnippets.sh 自动复制到目录 13 | 14 | 基础教程: http://blog.csdn.net/fatherhui 15 | 16 | QQ群:454686295 17 | 视频演示地址:http://pan.baidu.com/s/1kTEL1xP 18 | 19 | =========================================================================================== 20 | 21 | https://github.com/easycodingTop/EALayoutLiteForOC 22 | 23 | Use this framework, you can preview UI, don't need to compile again and again. 24 | Support for Swift Objective - C 25 | 26 | The introduction of framework, remember to add "-ObjC" to other linker Flags settings. 27 | 28 | Please use the xcode 6.4 above 29 | 30 | CodeSnippets content in ~/Library/Developer/Xcode/UserData/CodeSnippets directory, restart Xcode 31 | 32 | this is in a json file, there can be automatically prompt, write json quickly 33 | You can also use. / installSnippets.sh automatically copied to the directory 34 | 35 | Basic tutorial: http://blog.csdn.net/fatherhui 36 | QQ group: 454686295 37 | video demo address: http://pan.baidu.com/s/1kTEL1xP 38 | -------------------------------------------------------------------------------- /installSnippets.sh: -------------------------------------------------------------------------------- 1 | 2 | mkdir -p ~/Library/Developer/Xcode/UserData/CodeSnippets 3 | 4 | cp -rf CodeSnippets/* ~/Library/Developer/Xcode/UserData/CodeSnippets/ 5 | 6 | echo "please restart Xcode" 7 | 8 | --------------------------------------------------------------------------------