xcode - Swift- Set Visible menucontroller -
I'm trying to display UimenuController but I can not see it. How can i do
Give to the menu controller: UIMenuController = UIMenuController.sharedMenuController () menu controller. Menu = Useful = True MenuController.arrowDirection = UIMenuControllerArrowDirection.Down MenuController.setTargetRect (CGRectMake (100, 80, 50, 50), keeping in mind: self.view) Know MenuItem_1: UIMenuItem = UIMenuItem (Title: "Menu", Action: " Delete: ") MenuItems do: NSArray = [Delete] MenuController.menuItems = MenuItems
To actually display the menu, you need to do the following:
- Before calling getFirstResponder () you get your sharedMenuController
- call menu.setMenuVisible ( True, animated: true) finally
-
- c anBecomeFirstResponder override override function canPerformAction function
Write the function for the selector here is an example
someFunc () {beFirstResponder () Menu menu.menuItems = [deleteItem] menu.setTargetRect (CGRectMake (100, 80, 50, and so on): menu item (select "deleteLine" 50), keeping in mind: menu.setMenuVisible (True Animated: True)} function deleteLine () {// Here are some overrides function canBecomeFirstResponder () -> Bull {Return True} Overcoded Fun Canopperfectation (Action: Selector, Sender Sender: An Object?) - & gt; Bool {// You only need to return true for the actions you need, otherwise you can get the full range of // iOS if you can remove the statement here only. If the action == selector ("deleteline") returns {return true} return false}
Comments
Post a Comment