Skip to content

Commit

Permalink
修改readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjia committed Sep 12, 2018
1 parent 6b9f394 commit 32d85bf
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DDComponentsKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Pod::Spec.new do |s|
TODO: Add long description of the pod here.
DESC

s.homepage = 'https://github.com/[email protected]/DDComponentsKit'
s.homepage = 'https://github.com/DoNewsCode/DDComponentsKit'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '[email protected]' => '[email protected]' }
s.source = { :git => 'https://github.com/[email protected]/DDComponentsKit.git', :tag => s.version.to_s }
s.source = { :git => 'https://github.com/DoNewsCode/DDComponentsKit.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

s.ios.deployment_target = '8.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ - (void)viewDidLoad {
imagesComponent.images = self.imageModels;

self.rootComponent.subComponents = @[titlesComponent, imagesComponent, textComponent];

[self.collectionView reloadData];

}
Expand Down
18 changes: 9 additions & 9 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,60 @@

To run the example project, clone the repo, and run `pod install` from the Example directory first.

**可以通过该组件来创建模块比较多比较复杂的UICollectionView 或者tableView布局**
本组件的实现代码采用的是 [djs66256/DDComponent作者](https://github.com/djs66256/DDComponent)的DDComponent [源地址链接](https://github.com/djs66256/DDComponent)

原作者苍耳 关于组件对用的文章 [【美学的表现层组件化之路】](https://djs66256.github.io/2017/04/09/2017-04-09-美学的表现层组件化之路/)

## Requirements

第一步: 创建Root组件

@property (nonatomic, strong) DDCollectionViewRootComponent *rootComponent;

// 懒加载
- (DDCollectionViewRootComponent *)rootComponent {
if (_rootComponent == nil) {
_rootComponent = [[DDCollectionViewRootComponent alloc] initWithCollectionView:self.collectionView bind:YES];
}
return _rootComponent;
}


第二步: 创建自定义的模块组件 例如

```
// 标题组件
TGTitlesComponent *titlesComponent = [[TGTitlesComponent alloc] init];
titlesComponent.headerComponent = self.titleHeaderComponent;
titlesComponent.footerComponent = self.titleFooterComponent;
titlesComponent.cellModels = self.titleModels;
// 文本组件
TGTextComponent *textComponent = [[TGTextComponent alloc] init];
textComponent.headerComponent = self.headerComponent;
textComponent.footerComponent = self.footerComponent;
textComponent.cellModels = self.textModels;
// 图片组件
TGImagesComponent *imagesComponent = [[TGImagesComponent alloc] init];
imagesComponent.headerComponent = self.headerComponent;
imagesComponent.footerComponent = self.footerComponent;
imagesComponent.images = self.imageModels;
```

第三步: 将自定义组件数组赋值给root组件, 刷新控件

self.rootComponent.subComponents = @[titlesComponent, imagesComponent, textComponent];
[self.collectionView reloadData];


**更详细的用法请看DDComponentsKit组件代码的demo**

![](./images/img1.png)


## Installation

DDComponentsKit is available through [CocoaPods](https://cocoapods.org). To install
Expand Down
Binary file added images/img1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 32d85bf

Please sign in to comment.