Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding copy/paste/return panel in iOS 9 (Shortcuts panel)

I'am testing my application on iOS 9 Beta. Apple added a new panel with copy/paste/return functions.

I know I can disable it in general settings of my device.

Can I detect it in code using notifications? And can I tell my textFields and textViews don't show it when they are editing?

If I turn off the predictive view, the panel will display.

I've not found it in xCode 7 beta 4. If you know how to fix this issue please let me know it too :)

like image 945
Alex Balabanov Avatar asked Aug 07 '15 11:08

Alex Balabanov


People also ask

How do you stop copy and paste on iPhone?

Open "General" in the Settings app, then tap "AirPlay & Handoff." Next, toggle off the "Handoff" switch, and your iPhone will no longer give up its clipboard to other devices or have its clipboard taken over by other devices.

Is there a paste shortcut on iPhone?

Cut: Tap Cut or pinch closed with three fingers two times. Copy: Tap Copy or pinch closed with three fingers. Paste: Tap Paste or pinch open with three fingers.


2 Answers

I've solve the issue. I've found the way to hide this Shortcuts bar programmatically:

if ([textView respondsToSelector:@selector(inputAssistantItem)])
{
    UITextInputAssistantItem *inputAssistantItem = [textView inputAssistantItem];
    inputAssistantItem.leadingBarButtonGroups = @[];
    inputAssistantItem.trailingBarButtonGroups = @[];
}

Also you can detect the iOS Version if you need. Important to know UITextInputAssistantItem class is new class for iOS 9.

if ([[[UIDevice currentDevice] systemVersion] intValue] > 8.99)
{
    // Your super-code
}

Hope it will be useful information!

like image 182
Alex Balabanov Avatar answered Oct 19 '22 23:10

Alex Balabanov


Try this

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    if (action == @selector(paste:))
        return NO;
    return [super canPerformAction:action withSender:sender];
}

Hope it helps.

like image 20
Pradumna Patil Avatar answered Oct 19 '22 23:10

Pradumna Patil