作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在展示一个像这样的 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
吗?
这是它的样子:
轮换之前-
旋转后 -
最佳答案
很遗憾 UIKit
没有为我们正确处理这个问题。在我自己的应用程序中,我通过在我的 View Controller 中实现 didRotateFromInterfaceOrientation:
方法来处理这个问题,并使用更新后的 View 框架再次显示任何弹出窗口。
关于ios - UIActionSheet showFromRect 自动旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13710789/
我正在展示一个像这样的 UIActionSheet: -(void)accessoryPressed:(id)sender{ //Omitted unnecessary objects
在 iOS 7 中,我通过“showFromRect”显示 actionSheet: [actionSheet showFromRect:rect inView:view animated:YES];
我是一名优秀的程序员,十分优秀!