gpt4 book ai didi

iphone - 操作表高度

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:50:15 24 4
gpt4 key购买 nike

我在 UIActionSheet 上有一个简单的问题!如何设置 UIActionsheet 的高度?我试过 setFrame 和 setBounds 但没有任何效果。我正在使用以下操作表:

NSString *title = UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? @"\n\n\n\n\n\n\n\n\n" : @"\n\n\n\n\n\n\n\n\n\n\n\n" ;
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:[NSString stringWithFormat:@"%@%@", title, NSLocalizedString(@"", @"")]
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Button1",@"Button2", nil];
[actionSheet setTag: 1];
//[actionSheet setBounds:CGRectMake(0,0,320,150)];
//[actionSheet showFromRect:CGRectMake(0,0,100,50) inView: self.parentViewController.tabBarController.view animated:YES];
// [actionSheet setFrame:CGRectMake(0, 30, 320, 30)];
actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
[actionSheet showInView:self.parentViewController.tabBarController.view];
actionSheet = nil;

我的问题是操作表高度等于当前 View 的高度。我想根据 UIActionSheet 的内容自动调整高度。

提前致谢

最佳答案

UIActionSheet 的默认行为是自动调整其内容大小。您不应该直接设置 frame

您看到操作表占用了太多空间,因为您在标题中插入了一堆换行符,迫使标题标签占用了比应有的更多的垂直空间。如果您不希望操作表那么高,请不要那样改写标题。

关于iphone - 操作表高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10238179/

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