【发布时间】:2014-01-05 18:44:52
【问题描述】:
如果搜索到一个单词,我有这部分代码可以调出字典:
- (IBAction)searchButtonPressed:(id)sender
{
NSString *searchTerm = self.searchTextField.text;
if([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:searchTerm])
{
UIReferenceLibraryViewController *referenceLibraryVC = [[UIReferenceLibraryViewController alloc] initWithTerm:searchTerm];
[self presentModalViewController:referenceLibraryVC animated:NO];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Word not found" message:@"no definition" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
}
但是,它似乎只适用于 xib 的主视图并覆盖整个 iPad 屏幕。我怎样才能让它只在子视图中打开,只是屏幕的一部分?
【问题讨论】:
标签: ios objective-c ipad uiview uipopovercontroller