Skip to content

About

Subclass of UIAlertController

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

CustomAlertController

Subclass of UIAlertController

Development Environmental

  • Xcode 10.0
  • Swift 4.2

System Requirements

  • iOS 12

ActionSheet

actionsheet

@IBAction func actionSheetButtonTouched(_ sender: UIBarButtonItem) {
    let alert = CustomAlertController(title: "Very cute", message: "Animal, Pet, Cat", preferredStyle: .actionSheet)
    
    let storyboard = UIStoryboard(name: String(describing: CustomAlertSubtitleViewController.self), bundle: nil)
    let vc = storyboard.instantiateInitialViewController() as! CustomAlertSubtitleViewController
    vc.image = UIImage(named: "Cat")
    vc.text = alert.title
    vc.detailText = alert.message
    
    alert.contentViewController = vc
    alert.checkedIndex = 1
    
    alert.popoverPresentationController?.barButtonItem = sender
    
    alert.addAction(UIAlertAction(title: "SNS", style: .default) { action in
    })
    alert.addAction(UIAlertAction(title: "Mail", style: .default) { action in
    })
    alert.addAction(UIAlertAction(title: "Download", style: .default) { action in
    })
    alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) { action in
    })
    present(alert, animated: true)
}

Alert

alert

@IBAction func alertButtonTouched(_ sender: UIBarButtonItem) {
    let alert = CustomAlertController(title: "Very cute", message: "Animal, Pet, Cat", preferredStyle: .alert)
    
    let storyboard = UIStoryboard(name: String(describing: CustomAlertSubtitleViewController.self), bundle: nil)
    let vc = storyboard.instantiateInitialViewController() as! CustomAlertSubtitleViewController
    vc.image = UIImage(named: "Cat")
    vc.text = alert.title
    vc.detailText = alert.message
    
    alert.contentViewController = vc
    alert.checkedIndex = 1
    
    alert.addTextField { textField in
    }
    alert.addAction(UIAlertAction(title: "SNS", style: .default) { action in
    })
    alert.addAction(UIAlertAction(title: "Mail", style: .default) { action in
    })
    alert.addAction(UIAlertAction(title: "Download", style: .default) { action in
    })
    alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) { action in
    })
    present(alert, animated: true)
}

About

Subclass of UIAlertController

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages