我正在补充UIPickerView,UIActionsheet但它的工作完美,ios 7但没有工作ios 8.请帮我解决这个问题.
在这里我附上了截图.
谢谢
我正在使用以下代码.
UIActionSheet *actionSheet;
NSString *pickerType;
- (void)createActionSheet {
if (actionSheet == nil) {
// setup actionsheet to contain the UIPicker
actionSheet = [[UIActionSheet alloc] initWithTitle:@"Please select" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
actionSheet.backgroundColor = [UIColor clearColor];
UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
pickerToolbar.barStyle = UIBarStyleBlackOpaque;
[pickerToolbar sizeToFit];
UIImageView *imageObj = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)];
imageObj.image = [UIImage imageNamed:@"header.png"];
[pickerToolbar addSubview:imageObj];
UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; …Run Code Online (Sandbox Code Playgroud) 我对swift(以及iOS编程)完全不熟悉,但我开始搞乱它(当一切仍然是beta版本时,这不是一个好主意:D).所以我试着自己弄清楚,但仍然没有.甚至试图添加包含选择器的子视图而没有任何成功.那么任何人都可以帮助我吗?
在iOS 7中一直使用ActionSheetPicker让用户选择一个选项,它一直运行良好,直到我安装Xcode beta 2并在iOS 8中运行我的项目.有没有办法在iOS 8中执行此操作?
感谢您的帮助.
在iOS 8之前,我们不得不使用UIAlertView和UIActionSheet
我们不允许在它们上面混淆视图层次结构或子类.
UIAlertView类旨在按原样使用,不支持子类化.此类的视图层次结构是私有的,不得修改.
UIActionSheet不是设计为子类,也不应该为其层次结构添加视图.如果您需要提供比UIActionSheet API提供的更多自定义的工作表,您可以创建自己的工作表并使用presentViewController以模态方式呈现它:animated:completion:.
然而,iOS8 Apple已经推出UIAlertController了更换两者UIAlertView和UIActionSheet(请查看此处的预发布文档).
因此,在这个预发布文档中,没有任何关于无法子类化或更改视图层次结构,它甚至有这种方法,addTextFieldWithConfigurationHandler:因此我们能够更改视图层次和/或子类,UIAlertController而不必担心Apple是否会批准或拒绝我们的应用程序?