https://github.com/cmst0us/erslideshow
ERSlideShow 是一个支持Auto Layout的轮播组件
https://github.com/cmst0us/erslideshow
autolayout autolayout-constraints ios slideshow
Last synced: about 1 year ago
JSON representation
ERSlideShow 是一个支持Auto Layout的轮播组件
- Host: GitHub
- URL: https://github.com/cmst0us/erslideshow
- Owner: CmST0us
- Created: 2017-04-27T10:55:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-27T11:04:49.000Z (about 9 years ago)
- Last Synced: 2025-02-04T17:52:19.908Z (over 1 year ago)
- Topics: autolayout, autolayout-constraints, ios, slideshow
- Language: Objective-C
- Size: 19.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ERSlideShow
ERSlideShow 是一款iOS平台能支持Auto Layout的轮播组件
## 特性
1. 支持使用Interface Builder可视化Auto Layout创建实例
2. 支持使用传统`initWithFrame:`创建实例
3. 支持使用`addConstraints:`添加约束
## 示例
```
//从StoryBoard创建
[_slideShow setSlides:@[lb1, lb2, lb3, lb4]];
[_slideShow setDelegate:self];
[_slideShow setSlideShowMethod:ERSlideShowMethodLoop];
[_slideShow autoScrollWithDuration:2.0];
```
```
//代码构建
_slideShow2 = [[ERSlideShow alloc]initWithFrame:CGRectMake(0, 400, 200, 100)];
[_slideShow2 setSlides:@[lb11, lb12, lb13, lb14]];
[_slideShow2 setDelegate:self];
[_slideShow2 setSlideShowMethod:ERSlideShowMethodLoop];
[_slideShow2 autoScrollWithDuration:2.0];
[self.view addSubview:_slideShow2];
```
```
_slideShow3 = [[ERSlideShow alloc]init];
[_slideShow3 setSlides:@[lb21, lb22, lb23, lb24] showMethod:ERSlideShowMethodJump];
[_slideShow3 setDelegate:self];
[_slideShow3 autoScrollWithDuration:2.0];
[_slideShow3 setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:_slideShow3];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_slideShow3(==100)]-(8)-|" options:NSLayoutFormatAlignAllLeading metrics:nil views:NSDictionaryOfVariableBindings(_slideShow3)]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(8)-[_slideShow3(==200)]" options:NSLayoutFormatAlignAllLeading metrics:nil views:NSDictionaryOfVariableBindings(_slideShow3)]];
```
----------------
欢迎指出问题
`CmST0us`