Skip to content

yeziahehe/YFMoreViewController

Repository files navigation

YFMoreViewController

YFMoreViewController

Easy More Operation ViewController in swift.

中文文档

Introduction

More Operation like share and refresh, inspiration comes from Wechat More Operation. You can use YFMoreViewController just to share something, or to oprate webview.

Requirements

  • iOS 9.0 and later
  • Xcode 9.x and later
  • Swift 4.x and later(For Swift 3.x, use version 1.0.2)

Installation

CocoaPods

  • Simply add this line to your Podfile:
pod 'YFMoreViewController'
  • Run pod install.
  • Include with import YFMoreViewController to use it wherever you need.

Manually

  • Add sources floder's files YFMoreItemViewYFMoreViewDelegateYFMoreViewController to your project (3 files total).
  • Include with import YFMoreViewController to use it wherever you need.

Usage

Preparation

Note

YFMoreViewController consists of three parts: info, item important and item normal. They can all be empty, it will just show cancel button.

  • info: if you use YFMoreViewController in WebView, here you can show "Powered By website"

  • item important: here always show share platform, just like Wechat etc. If you just use item important, YFMoreViewController may replace your share ViewController

  • item normal: here always show normal operation, you can use with WebView or some other you need

Basic Usage

You just init YFMoreViewController, then add items and show, it will OK.

let moreViewController = YFMoreViewController.init()
moreViewController.delegate = self

moreViewController.addInfo("Powered By yeziahehe.com")
moreViewController.addItems(title: "Wechat", image: UIImage(named: "wechat"), type: .important, tag: "wechat")
moreViewController.addItems(title: "Open With Safari", image: UIImage(named: "safari"), type: .normal, tag:"safari")

moreViewController.showFromBottom()

Then you need implement protocol.

func moreView(_ moreview: YFMoreViewController, didSelectItemAt tag: String, type: YFMoreItemType) {
  switch tag {
  case "wechat":
      return
  case "safari":
      UIApplication.shared.open(URL(string: "http://yeziahehe.com")!, options: [:], completionHandler: nil)
      print("safari")
      return
  }
}

About

License

YFMoreViewController is available under the MIT license. See the LICENSE file for more info.

About

Easy More Operation ViewController

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages