benjiiiii
benjiiiii

Reputation: 478

Adding a button to the bottom of every view - Swift

I'm working on an iOS application. I would like to add a constant button that will show at the bottom of every view within the app. I could obviously just create the button on every view. However, I'm sure there will be a way of creating the button once and having it appear multiple times.

Does anyone have any tips on how this can be done?

I effectively want a navigation bar on the bottom of my app that has a custom button on it?

Upvotes: 0

Views: 617

Answers (1)

Prashant Tukadiya
Prashant Tukadiya

Reputation: 16416

You can add Any of view in main window of app. so it will be visible in every screen

(UIApplication.shared.delegate as! AppDelegate).window?.addSubview(yourButton)
(UIApplication.shared.delegate as! AppDelegate).window?.bringSubview(toFront: yourButton)

Hope it is helpful

Upvotes: 2

Related Questions