相关疑难解决方法(0)

来自Popover的UIActionSheet与iOS8 GM

在尝试从popover显示UIActionSheet时,是否有人收到此消息?

您的应用程序提供了样式UIAlertControllerStyleActionSheet的UIAlertController().具有此样式的UIAlertController的modalPresentationStyle是UIModalPresentationPopover.您必须通过警报控制器的popoverPresentationController为此弹出窗口提供位置信息.您必须提供sourceView和sourceRect或barButtonItem.如果在显示警报控制器时未知此信息,则可以在UIPopoverPresentationControllerDelegate方法-prepareForPopoverPresentation中提供该信息.

在GM之前,我使用了一些解决方法将UIActionSheet转换为UIAlertController,这很好用.然而,似乎Apple试图解决UIActionSheet问题,我不想使用我的解决方法 - 但似乎我别无选择......

uiactionsheet uipopovercontroller ios ios8 uialertcontroller

47
推荐指数
3
解决办法
2万
查看次数

如何在iPhone中创建警报框?

我想创建一个警告类型框,以便当用户尝试删除某些内容时,它会说"你确定",然后如果他们确定则为是或否.在iPhone上做这个的最好方法是什么?

iphone objective-c uialertview ios

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

Swift UIActionSheet在iPad上崩溃了吗?

我目前遇到了完全的挫折,因为我找不到任何错误,但我的ActionSheet在iPad上崩溃但在iPhone上运行良好这里是动作的代码

if (view.annotation.title as String!) == "San Francisco" {

                currentLat = 37.615223
                    currentLong = -122.389977

                url = "www.google.de"

                let action:UIActionSheet = UIActionSheet(title: "Change Map Type", delegate: self, cancelButtonTitle: "Back", destructiveButtonTitle: nil, otherButtonTitles: "Product Page", "Video")
                action.showInView(self.view)
                action.tag = 0
                VideoID = "XXXXXX"


            }
Run Code Online (Sandbox Code Playgroud)

所以应该处理的行动是

if actionSheet.tag == 0{
            if buttonIndex == 1{ performSegueWithIdentifier("showShop", sender: self) }
            if buttonIndex == 2{ UIApplication.sharedApplication().openURL(NSURL(string: "http://www.youtube.com/watch?v=\(youtubeVideoID)")) }
            //if buttonIndex == 2{ performSegueWithIdentifier("showYoutube", sender: self) }

        }
Run Code Online (Sandbox Code Playgroud)

Youtube可以在iPhone和iPad上运行良好,"showShop"在iPhone上运行良好但在iPad上运行不正常

"showShop"向前看我的ViewControllerShopView看起来像

import UIKit

class ViewControllerShopView: UIViewController { …
Run Code Online (Sandbox Code Playgroud)

uiactionsheet ipad swift

2
推荐指数
1
解决办法
3268
查看次数

出现UIAlertController时应用崩溃

尝试提供时,我的应用崩溃了UIAlertController

我有一个UIViewController模态呈现的,然后在该呈现的视图控制器上,当点击某个按钮时,我想呈现一个actionSheet警报。

执行此操作时,应用程序崩溃了,我无法弄清楚原因。

这是代码:

let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: "Image from Camera", style: .default, handler: { (_) in
    let cameraController = CameraController()
    self.present(cameraController, animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: "Image from Library", style: .default, handler: {(_) in
    let imagePickerController = UIImagePickerController()
    imagePickerController.delegate = self
    imagePickerController.allowsEditing = true
    self.present(imagePickerController, animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
alertController.view.tintColor = UIColor.rgb(red: 46, green: 94, blue: 120)
self.present(alertController, animated: …
Run Code Online (Sandbox Code Playgroud)

ios swift uialertcontroller ios11

2
推荐指数
1
解决办法
2395
查看次数