Showing UIMenuController loses keyboard

前端 未结 2 1452
别跟我提以往
别跟我提以往 2021-02-09 04:33

I\'m making an iphone app similar to the Messages app that comes on the phone. I just set up the ability to copy messages via a UIMenuController, but if the keyboard is showing

2条回答
  •  不知归路
    2021-02-09 05:05

    In iOS 5, you can now use the table view delegate methods to show the Menu Controller:

    - (BOOL) tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath
    
    - (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender;
    
    - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender;
    

    Showing the Menu Controller in this manner will not resign the keyboard.

    I'm still curious about this though as I have an app that supports pre-iOS 5 that I would like to do what you're saying also (not resign the keyboard when the copy menu appears).

提交回复
热议问题