Skip to content

Commit

Permalink
更新demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengYidong committed Jan 5, 2017
1 parent 9198268 commit 9d4dc61
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,32 @@ func load(load: MBLoadable = MBLoadType.none) -> Self

#### Show mask on UIViewController

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_loadable_uiviewcontroller.gif)

``` swift
request(WeatherForm()).load(load:MBLoadType.default(container: view))
```

#### Show mask on UINavigationController

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_loadable_uinavigationcontroller.gif)

``` swift
request(WeatherForm()).load(load: MBLoadType.default(container: navigationController!.view))
```

#### Show mask on UIButton

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_loadable_button.gif)

``` swift
request(WeatherForm()).load(load: button)
```

#### Show customized mask

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_loadable_customized.gif)

Firstly, we create a `LoadConfig` class conforms to `MBLoadable` protocol.

``` swift
Expand Down Expand Up @@ -214,6 +222,8 @@ This is the most powful usage of the `MBLoadable` protocol. In this way you can

#### Show mask on UITableView & UIScrollView

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_loadable_uiscrollview.gif)

``` swift

let load = LoadConfig(container:self.tableView, mask: MBActivityIndicator(), inset: UIEdgeInsetsMake(UIScreen.main.bounds.width - self.tableView.contentOffset.y > 0 ? UIScreen.main.bounds.width - self.tableView.contentOffset.y : 0, 0, 0, 0))
Expand All @@ -223,6 +233,8 @@ request(WeatherForm()).load(load: load)

#### Show mask on UITableViewCell (PS: Still in development)

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_loadable_cell.gif)

``` swift
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView .deselectRow(at: indexPath, animated: false)
Expand All @@ -241,6 +253,8 @@ func progress(progress: MBProgressable) -> Self

And then we can use it as followed:

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_progressable.gif)

``` swift
download(ImageDownloadForm()).progress(progress: progress)
```
Expand All @@ -255,6 +269,8 @@ func warn<T: MBJSONErrorable>(error: T, warn: MBWarnable = MBMessageType.none, c

And then we can use it as followed:

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_warnable.gif)

``` swift
request(WeatherForm()).warn(error: WeatherError(), warn: MBMessageType.alertController(title: "Warning", message: "Network unavailable", actions: [UIAlertAction(title: "Ok", style: UIAlertActionStyle.cancel, handler: nil)], container: self))
```
Expand All @@ -270,6 +286,8 @@ func inform<T: MBJSONErrorable>(error: T, inform: MBInformable = MBMessageType.n

And then we can use it as followed:

![](https://github.com/mmoaay/MBNetwork/blob/master/Demo/mbnetwork_informable.gif)

``` swift
request(WeatherForm()).inform(error: WeatherInformError(), inform: MBMessageType.alertController(title: "Notice", message: "Load successfully", actions: [UIAlertAction(title: "Ok", style: UIAlertActionStyle.cancel, handler: nil)], container: self))
```
Expand Down

0 comments on commit 9d4dc61

Please sign in to comment.