So I've created a custom view which I want to be displayed at the bottom of the screen to when a UIMenuItem is clicked.
I have in my ViewController.m :
UIMenuController *menuController = [UIMenuController sharedMenuController];
UIMenuItem *translateItem = [[UIMenuItem alloc] initWithTitle:@"Translate" action:@selector(translateClicked:)];
[menuController setMenuItems:[NSArray arrayWithObject:translateItem]];
The UITextView concerned has a custom UITextView with the methods (CustomTextView.m):
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(copy:)) return YES;
if (action == @selector(translateClicked:)) return YES;
return NO;
}
- (IBAction)translateClicked:(id)sender
{
NSLog(@"In Custom UITextView");
}
This shows "Copy" and "Translate" as the two menu options. Currently when "Translate" is clicked I get the log "In Custom UITextView".
Is it possible to have a method within the ViewController.m to have the following code?
CustomPopUp *customView = [CustomPopUp customView];
[self.view addSubview:customView];