Swift version of FTPopOverMenu.
FTPopOverMenu is a pop over menu for iOS
which is maybe the easiest one to use, supports both portrait
and landscape
. It can show from any UIView
, any UIBarButtonItem
and any CGRect
. Simplest APIs, enable you to change the style in one line of code.
somtimes I want to customer every cell, so I seperate the global setting, and cell setting. e.g: my PM want some menu item are show but can't tap for some reason.
FTPopOverMenu_Swift
is available through CocoaPods. To install it, simply add the following line to your Podfile
:
FTPopOverMenu_Swift
to FTPopOverMenu
target 'MyApp' do
pod 'FTPopOverMenu_Swift', '~> 0.1.4'
end
Then run a pod install inside your terminal, or from CocoaPods.app.
Do any of the following settings to set the style (Only set the ones you want to change), maybe do this when app starts or when you want it to show a different style, but remember it's global change.
let configuration = FTConfiguration.shared
configuration.menuRowHeight = ...
configuration.menuWidth = ...
configuration.textColor = ...
configuration.textFont = ...
configuration.tintColor = ...
configuration.borderColor = ...
configuration.borderWidth = ...
configuration.textAlignment = ...
configuration.ignoreImageOriginalColor = ...;
// set 'ignoreImageOriginalColor' to YES, images color will be same as textColor
FTPopOverMenu.showForSender(sender: sender,
with: ["Share"],
done: { (selectedIndex) -> () in
print(selectedIndex)
}) {
}
FTPopOverMenu.showForSender(sender: sender,
with: ["Share"],
menuImageArray: ["iconImageName"],
done: { (selectedIndex) -> () in
print(selectedIndex)
}) {
}
FTPopOverMenu.showFromSenderFrame(senderFrame: sender.frame,
with: ["Share"],
done: { (selectedIndex) -> () in
}) {
}
FTPopOverMenu.showFromSenderFrame(senderFrame: sender.frame,
with: ["Share"],
menuImageArray: ["iconImageName"],
done: { (selectedIndex) -> () in
}) {
}
@IBAction func handleAddBarButtonItem(_ sender: UIBarButtonItem, event: UIEvent) {
FTPopOverMenu.showForEvent(event: event,
with: ["Share"],
menuImageArray: ["iconImageName"],
done: { (selectedIndex) -> () in
}) {
}
}
star
.UIPopoverViewController
, and more genetic and more good-looking. Feel free to try it.FTPopOverMenu_Swift
is available under the MIT
license. See the LICENSE
file for more info.
link |
Stars: 424 |
Last commit: 3 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics