Domanda

I was recommended to use a UIPopovercontroller in order to display my UIReferenceLIbraryViewController so that the dictionary does not take up the entire screen when I click my UIButton "search"

What I have is a UITextField that takes in the string/word, a button that will search it and pull up the UIReferenceLibraryViewController.

I'm having problems using a popovercontroller to do this. When I tried it, the button doesn't respond. Any tips/help??

edit:

UIReferenceLibraryViewController in a popover

It was originally

  if([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:searchTerm])
    {

        UIReferenceLibraryViewController *referenceLibraryVC = [[UIReferenceLibraryViewController alloc] initWithTerm:searchTerm];

        [self presentModalViewController:referenceLibraryVC animated:YES]; 

            }

which makes it take up the entire ipad screen

Does UIReferenceLIbraryViewController have initWithFrame? that solution didn't seem to work for me either

È stato utile?

Soluzione

Thanks to Leo Nathan's help, it works now.

 self.masterPopOverController = [[UIPopoverController alloc] initWithContentViewController:referenceLibraryVC];
        [self.masterPopOverController presentPopoverFromRect:[sender frame] inView:[sender superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

I didn't connect it correctly in the XIB file and it wasn't implemented in the correct place in the IBAction for ButtonPress

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top