Written as Swift 4 and tested on iOS 9.
NXMActionSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'NXMActionSheet'
import NXMActionSheet
Chaining
//add items
add(imageViewData)
.add(datas: labelViewDataList)
.insert(twoButtonData, at: 0)
Default views make it easy to show
NXMActionSheet()
.add(.init(.image(/*image*/))))
.add(.init(.activityIndicator(.gray)))
.add(.init(.slider(0.5, nil)))
.add(.init(.label("Label")))
.add(.init(.button("Button", UIColor.brown, nil), withTouchClose: true))
.show()
When using inheritance, be sure to include the following functions
class CustomActionSheet : NXMActionSheet {
convenience init (withType:NXMActionSheetAnimationType = .slide) {
self.init(frame: .zero)
}
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
Create .xib and .swift with the same name and use it as follows
//ImageView
let customImageView = CustomImageView.loadView()
customImageView.imageView.image = /*image*/
let imageViewData = NXMActionSheetData(.custom(imageView))
...
add(imageViewData)
please check the example for details
//require
func didSelectActionItem(_ actionSheet:NXMActionSheet, withData:NXMActionSheetData)
//optional
func actionSheetWillShow()
func actionSheetDidShow()
func actionSheetWillHide()
func actionSheetDidHide()
func actionSheetWillUpdate()
func actionSheetDidUpdate()
If content height in UITableView is larger than UIScreen height, scrolling is enabled. However, if you set the scroll position on update, it is possible that the transition is not smooth.
To run the example project, clone the repo, and run pod install
from the Example directory first.
nExmond, [email protected]
NXMActionSheet is available under the MIT license. See the LICENSE file for more info.