Skip to content

Commit

Permalink
1. Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoiOS committed Dec 7, 2015
1 parent 7e5abb0 commit 71ac765
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
4 changes: 2 additions & 2 deletions LCActionSheet.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|

s.name = "LCActionSheet"
s.version = "1.0.6"
s.summary = "Show a simple elegance action sheet with one line of code."
s.version = "1.1.0"
s.summary = "Show a simple elegance action sheet with one line of code. Support: http://LeoDev.me"
s.homepage = "https://github.com/LeoiOS/LCActionSheet"
s.license = "MIT"
s.author = { "Leo" => "leoios@sina.com" }
Expand Down
45 changes: 31 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,42 @@ OK,这次我是看系统的 UIActionSheet 不爽。不能更改 tintColor (蓝


## 代码 Code

*
- 方法一:[CocoaPods](https://cocoapods.org/) 导入:`pod 'LCActionSheet'`
- 方法二:把 LCActionSheet 文件夹(在 Demo 中)拖到你的项目中。
- 方法二:把 LCActionSheet 文件夹(在 Demo 中)拖到你的项目中

* 在相应位置导入头文件: `#import "LCActionSheet.h"`,遵守协议`<LCActionSheetDelegate>`
* 调用下面的方法即可:
```objc
// 1. 类方法
LCActionSheet *sheet = [LCActionSheet sheetWithTitle:nil buttonTitles:@[@"拍照", @"从相册选择"] redButtonIndex:-1 delegate:self];
[sheet show];
````objc
// 1. 类方法 + Block
LCActionSheet *sheet = [LCActionSheet sheetWithTitle:nil buttonTitles:@[@"拍照", @"从相册选择"] redButtonIndex:-1 clicked:^(NSInteger buttonIndex) {

// 2. 实例方法
LCActionSheet *sheet = [[LCActionSheet alloc] initWithTitle:@"你确定要注销吗?" buttonTitles:@[@"确定"] redButtonIndex:0 delegate:self];
[sheet show];
```
NSLog(@"Block way: %ld", (long)buttonIndex);
}];

[sheet show];


// 2. 实例方法 + Delegate
LCActionSheet *sheet = [[LCActionSheet alloc] initWithTitle:@"你确定要注销吗?"
buttonTitles:@[@"确定"]
redButtonIndex:0
delegate:self];

[sheet show];
````
* 监听方法(代理方法,可选实现):
```objc
- (void)actionSheet:(LCActionSheet *)actionSheet didClickedButtonAtIndex:(NSInteger)buttonIndex;
```
````objc
- (void)actionSheet:(LCActionSheet *)actionSheet didClickedButtonAtIndex:(NSInteger)buttonIndex;
````



## 更新日志 2015.12.07 Update Logs (Tag: 1.1.0)
* 要 Block?满足你!
* 优化逻辑:创建 ActionSheet 时,不再添加到 window 上。



Expand Down Expand Up @@ -61,8 +78,8 @@ OK,这次我是看系统的 UIActionSheet 不爽。不能更改 tintColor (蓝
## 提示 Tips
- LCActionSheet 是添加到当前的 Window 上,没适配横屏。
- 提供了 title、buttons、redButton、cancelBtn 这些杂七杂八的东东,应该全了。
- buttonIndex 从上到下从 0 依次递增。如果不想有 redButton,在`redButtonIndex:`处传个`-1`即可。
- 协议`<LCActionSheetDelegate>`能监听到点击的按钮的 index,这个方法是可选实现的。
- buttonIndex 从上到下从 0 依次递增。如果不想有 redButton,在 `redButtonIndex:` 处传 `-1` 即可。
- 协议 `<LCActionSheetDelegate>` 能监听到点击的按钮的 index,这个方法是可选实现的。



Expand Down

0 comments on commit 71ac765

Please sign in to comment.