gpt4 book ai didi

iphone - 从 contentViewController 中消除 UIPopOverController

转载 作者:行者123 更新时间:2023-12-03 20:46:20 26 4
gpt4 key购买 nike

如何从 contentViewController 中消除弹出窗口,因此在下面的示例代码中,我想从 ProfileViewController 代码中消除 UIPopOver。我该怎么做呢?另一篇类似的文章建议使用 NSNotification,但如何使用它?

- (void)profilePop:(UITapGestureRecognizer *)recognizer
{
ProfileViewController * profile = [[ProfileViewController alloc] init];
CGPoint location = [recognizer locationInView:self.table];
NSIndexPath* indexPath = [self.table indexPathForRowAtPoint:location];
ConvoreCell* cell = (ConvoreCell *) [self.table cellForRowAtIndexPath:indexPath];
profile.uid = [[[self.posts objectAtIndex:indexPath.row] creator] mid];
UIPopoverController * profilePop = [[UIPopoverController alloc] initWithContentViewController:profile];
[profilePop setPopoverContentSize:CGSizeMake(350, 180)];
[profilePop presentPopoverFromRect:CGRectMake(0,0, cell.avatar.frame.size.width, cell.avatar.frame.size.height) inView:cell permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}

最佳答案

我会在您的个人资料类中保留对弹出窗口的引用。

profile.popOver = profilePop;

然后在您想要关闭的区域中:

[self.popover dismissPopoverAnimated:YES];

关于iphone - 从 contentViewController 中消除 UIPopOverController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6037701/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com