相关疑难解决方法(0)

将UIDatePicker拟合到UIActionSheet中

我正在尝试使用UIButton获取UIDatePicker以显示在UIActionSheet中.不幸的是,它被裁掉了,整个日期选择器都不可见.我还没有尝试过添加UIButton.任何人都可以建议让整个视图适合吗?我不确定如何添加适当的尺寸,因为UIActionSheet似乎缺少-initWithFrame:类型构造函数.

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker" 
                                                  delegate:self
                                         cancelButtonTitle:@"Cancel"
                                    destructiveButtonTitle:nil
                                         otherButtonTitles:nil];

// Add the picker
UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;
[menu addSubview:pickerView];
[menu showInView:self.view];

[pickerView release];
[menu release];
Run Code Online (Sandbox Code Playgroud)

我也尝试过类似的东西:

UIActionSheet *menu = [[UIActionSheet alloc] initWithFrame:CGRectMake(200.0, 200.0, 100.0f, 100.0f)];
Run Code Online (Sandbox Code Playgroud)

这些坐标是不现实的,但它们似乎不会影响UIActionSheet的位置/大小.

iphone cocoa-touch objective-c uidatepicker

37
推荐指数
5
解决办法
5万
查看次数

Iphone:可以隐藏TabBar吗?(iOS 8之前)

我有一个使用a UITabBarController在模式之间切换的应用程序.在某种模式下,我想隐藏标签栏,直到该模式的步骤完成.请注意,我没有使用导航控制器,所以我无法使用setHidesBottomBarWhenPushed导航控制器上的方法来隐藏标签栏.

在iOS 8之前,当我尝试使用以下命令隐藏tarbar时:

self.tabBarController.tabBar.hidden = YES
Run Code Online (Sandbox Code Playgroud)

标签栏消失,但它在屏幕底部留下了一个50像素的空白区域,标签栏曾经是.我似乎无法弄清楚如何填补该区域.用户界面中该区域中的任何内容都被剪切,无法看到.

任何想法,如果这是可能的?我真的很想远离导航控制器.

iphone objective-c uitabbarcontroller ios

34
推荐指数
4
解决办法
3万
查看次数