Skip to content

outofcoding/NotchButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NotchButton

CI Status Version License Platform

Installation

NotchButton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NotchButton'

Requirements

  • iOS 8.0

Screenshot

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Notch style phone bottom support. set height. Auto Increment the Bottom SafeAreaInset.bottom

// button1 is Bottom Anchor
let button1 = NotchButton()
button1.translatesAutoresizingMaskIntoConstraints = false
button1.backgroundColor = .gray
button1.setTitle("Notch Area", for: .normal)
button1.height = 40

view.addSubview(button1)
NSLayoutConstraint.activate([
    button1.leftAnchor.constraint(equalTo: view.leftAnchor),
    button1.rightAnchor.constraint(equalTo: view.rightAnchor),
    button1.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])

// button2 is Center Anchor
let button2 = NotchButton()
button2.translatesAutoresizingMaskIntoConstraints = false
button2.backgroundColor = .gray
button2.setTitle("Not Notch Area", for: .normal)
button2.height = 40

view.addSubview(button2)
NSLayoutConstraint.activate([
    button2.leftAnchor.constraint(equalTo: view.leftAnchor),
    button2.rightAnchor.constraint(equalTo: view.rightAnchor),
    button2.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])

Author

License

NotchButton is available under the MIT license. See the LICENSE file for more info.

About

Insert bottom inset for notch style phone bottom.

Resources

License

Stars

Watchers

Forks

Packages

No packages published