0

我有一个使用标准流布局的 UICollectionView。流布局呈现文档的集合。

当您点击其中一个时,UIDocumentInteractionController 会显示能够处理该文档类型的可用应用程序列表。UIDocumentInteractionController 中的小箭头指向我点击的文档。我正在使用可重复使用的单元格框架矩形来识别单元格的位置。

在升级到 iOS7 之前,我相信这很好用。现在我遇到了一个问题,即 UIDocumentInteractionController 没有出现在正确的位置。

代码如下所示:

NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:item.templateLink ofType:@"" ]];
docController = [self setupControllerWithURL:fileURL
                               usingDelegate:self];
TBTemplateViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TemplateCell" forIndexPath:indexPath];
CGRect rect1 = cell.frame;
bool didShow = [docController presentOptionsMenuFromRect:rect1 inView:self.view animated:YES];

好像 cell.frame 不再有相同的参考点?

非常感谢任何帮助。

非常感谢,D。

4

1 回答 1

0

玩了一段时间后,似乎我应该使用presentOptionsMenuFromRectoncollectionView而不是self.view. 所以代码现在看起来像这样:

NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:item.templateLink ofType:@"" ]];
docController = [self setupControllerWithURL:fileURL
                           usingDelegate:self];
TBTemplateViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TemplateCell" forIndexPath:indexPath];
CGRect rect1 = cell.frame;
bool didShow = [docController presentOptionsMenuFromRect:rect1 inView:collectionView animated:YES];

那个听起来是对的吗?它似乎已经成功了。有谁知道这是否会在 iOS7 中发生变化,或者我之前是否只是逃避它?

于 2013-10-09T09:44:34.520 回答