這些已被棄用,但我沒有找到解決方案來改善它:actionSheet:didDismissWithButtonIndex:已在iOS 8.3中棄用。我現在必須使用什麼新方法?
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Take Photo", nil) style:UIAlertActionStyleDefault handler:^(__unused UIAlertAction *action)
{
[self actionSheet:nil didDismissWithButtonIndex:0];
}]];
和:
[[[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"Take Photo", nil), NSLocalizedString(@"Photo Library", nil), nil] showInView:controller.view];
最後:
- (void)actionSheet:(__unused UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
switch (buttonIndex)
{
case 0:
{
sourceType = UIImagePickerControllerSourceTypeCamera;
break;
}
case 1:
非常感謝。
⌘-點擊'UIActionSheet'。在那裏你會發現如何更換它的建議。 – vadian