gpt4 book ai didi

ios - UIActionSheet showFromRect 自动旋转

转载 作者:可可西里 更新时间:2023-11-01 03:49:38 24 4
gpt4 key购买 nike

我正在展示一个像这样的 UIActionSheet:

-(void)accessoryPressed:(id)sender{
//Omitted unnecessary objects

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:titleString delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:@"Upload", nil];
//actionSheet.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
actionSheet.tag = ((UIButton*)sender).tag;
[actionSheet showFromRect:[(UIButton*)sender frame] inView:[(UIButton*)sender superview] animated:YES];
}

sender 对象是嵌入在 UITableViewCell 的附属 View 中的 UIButton

问题是当 iPad 旋转时,操作表没有调整大小(我不希望它实际调整大小,但我希望它在正确的 X、Y 中)我尝试将 AutoResizingMask 设置为 FlexibleLeft 和 FlexibleTop 但它似乎没有改变。

有人知道如何让 actionSheet 在自动旋转后指向 accessoryView 吗?

这是它的样子:

轮换之前- Before Rotation

旋转后 - enter image description here

最佳答案

很遗憾 UIKit 没有为我们正确处理这个问题。在我自己的应用程序中,我通过在我的 View Controller 中实现 didRotateFromInterfaceOrientation: 方法来处理这个问题,并使用更新后的 View 框架再次显示任何弹出窗口。

关于ios - UIActionSheet showFromRect 自动旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13710789/

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