UIActionSheet _button valueforKey在iOS8中崩溃

Fir*_*ist 0 uiactionsheet ios ios8

iOS 8,代码崩溃后添加图像UIActionSheet's _button valueForKey.

UIActionSheet *action = [[UIActionSheet alloc ] initWithTitle:@"Choose Action!" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Start Auto Scroll", nil];

[[[action valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"autoScroll.png"] forState:UIControlStateNormal];

[action showInView:self.view];
Run Code Online (Sandbox Code Playgroud)

崩溃日志是

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIActionSheet 0x7ff6d8c61030> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _buttons.'
Run Code Online (Sandbox Code Playgroud)

我怎么解决呢?

mat*_*att 5

你在做什么从来都不合法.您无法直接修改操作表的界面.如果您的代码曾经过App Store Guardians,那只是一个疏忽.

使用自定义演示文稿过渡动画来制作看起来像操作表的视图控制器视图(或者,实际上,看起来像操作表的视图控制器视图).在iOS 7和8中,制作部分覆盖屏幕的呈现视图控制器视图非常简单且合法.