var alertController = UIAlertController(Title: "How to Skate",message: "Tap the screen to perform a trick and jump over the obsticles (You can grind on rails) The game will end when you hit a highlighted red,orange or yellow obstacle. That's it! + Image",preferredStyle: UIAlertControllerStyle.Alert) alertController.addAction(UIAlertAction(Title: "Cool!",style: UIAlertActionStyle.Cancel,handler: nil))self.vIEw?.window?.rootVIEwController?.presentVIEwController(alertController,animated: true,completion: nil)解决方法 您可以将UIImageVIEw作为子视图添加到UIAlertController.
var imageVIEw = UIImageVIEw(frame: CGRectMake(220,10,40,40))imageVIEw.image = yourImagealert.vIEw.addSubvIEw(imageVIEw)
这是你在UIAlertController中的表现:
let alertMessage = UIAlertController(Title: "My Title",message: "My Message",preferredStyle: .Alert)let image = UIImage(named: "myImage")var action = UIAlertAction(Title: "OK",style: .Default,handler: nil)action.setValue(image,forKey: "image")alertMessage .addAction(action)self.presentVIEwController(alertMessage,completion: nil)总结
以上是内存溢出为你收集整理的ios – 将图像添加到UIAlertController全部内容,希望文章能够帮你解决ios – 将图像添加到UIAlertController所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)