Easy More Operation ViewController in swift.
More Operation like share and refresh, inspiration comes from Wechat More Operation. You can use YFMoreViewController just to share something, or to oprate webview.
- iOS 9.0 and later
- Xcode 9.x and later
- Swift 4.x and later(For Swift 3.x, use version 1.0.2)
- Simply add this line to your
Podfile
:
pod 'YFMoreViewController'
- Run
pod install
. - Include with
import YFMoreViewController
to use it wherever you need.
- Add sources floder's files
YFMoreItemView
、YFMoreViewDelegate
、YFMoreViewController
to your project (3 files total). - Include with
import YFMoreViewController
to use it wherever you need.
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
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
}
}
- Blog
- Gmail: [email protected]
YFMoreViewController is available under the MIT license. See the LICENSE file for more info.