【发布时间】:2016-02-17 13:59:11
【问题描述】:
我正在彻底改造一个旧项目,因为他们使用UIActionSheet,我不熟悉它,所以请帮我找出来。
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"beard Selection" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"" otherButtonTitles:@"", @"", @"", @"", @"", @"", @"", @"", nil];
NSLog(@"kishore calculation ");
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"ca1.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:1] setImage:[UIImage imageNamed:@"ca2.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:2] setImage:[UIImage imageNamed:@"ca3.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:3] setImage:[UIImage imageNamed:@"ca4.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:4] setImage:[UIImage imageNamed:@"ca5.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:5] setImage:[UIImage imageNamed:@"ca6.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:6] setImage:[UIImage imageNamed:@"ca7.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:7] setImage:[UIImage imageNamed:@"ca8.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:8] setImage:[UIImage imageNamed:@"ca9.png"] forState:UIControlStateNormal];
[[[popupQuery valueForKey:@"_buttons"] objectAtIndex:9] setImage:[UIImage imageNamed:@"ca10.png"] forState:UIControlStateNormal];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery setTag:Cap];
[popupQuery showInView:self.view];
UIActionSheet 就像UIAlertView,因为他们试图添加按钮,但我收到这样的错误,
由于未捕获的异常“NSUnknownKeyException”而终止应用程序, 原因:'[valueForUndefinedKey:]:这个 类不符合键按钮的键值编码。'
指导我克服这个:)
【问题讨论】:
-
UIActionSheet 已被弃用,为什么你不尝试 uialertcontroller
标签: ios objective-c uiactionsheet