Comments (3)
@Isuru-Nanayakkara hey guys,
You don't need to change source code of the library. You just need to change automaticallyAdjustsScrollViewInsets
of UIViewController to false
from swiftyonboard.
Quick win solution
Solved by adding the height of the navigationBar in the height of containerView in the setupContainerView method in SwiftyOnBoard class.
if navigationBarIsPresent {
var newFrame = frame
newFrame.size.height = frame.height + 64
self.containerView.frame = newFrame
} else {
self.containerView.frame = frame
}
declaration
open var navigationBarIsPresent: Bool = false
set
self.swiftOnBoard.navigationBarIsPresent = true
self.swiftOnBoard.delegate = self
self.swiftOnBoard.dataSource = self
from swiftyonboard.
Thanks @Nexmind. I was experiencing this issue as well. I took your solution and expanded on it a little. Instead of hardcoding the navigation bar height and adding an extra property, I added the following extension method to retrieve the parent view controller in which this view is displayed.
private extension UIView {
var parentController: UIViewController? {
var parentResponder: UIResponder? = self
while parentResponder != nil {
parentResponder = parentResponder!.next
if let viewController = parentResponder as? UIViewController {
return viewController
}
}
return nil
}
}
After that in the setupContainerView
method, I simply check if the parent view controller has a navigation controller and get its navigation bar's height this way.
if let navigationBar = self.parentController?.navigationController?.navigationBar {
var newFrame = self.frame
newFrame.size.height = self.frame.height + navigationBar.frame.height
self.containerView.frame = newFrame
} else {
self.containerView.frame = self.frame
}
Created a PR #25. If it doesn't get merged, you can still add the following to your Podfile
if you're using CocoaPods.
pod 'SwiftyOnboard', :git => 'https://github.com/Isuru-Nanayakkara/SwiftyOnboard.git', :branch => 'navbar-fix'
from swiftyonboard.
Related Issues (20)
- swiftyOnboardOverlayForPosition never being called HOT 1
- How do I code what view controller is linked to the continue button? HOT 3
- UIPageControl dots isn't connected HOT 2
- how to use auto slide onboarding? HOT 2
- Can I animate while swipe?
- Changing orientation doesn't change view orientation
- SwiftyOnboardPage not showing HOT 1
- How to style the images HOT 3
- How to customize labels and buttons of SwiftyOnboardOverlay or SwiftyOnboard HOT 3
- Crash when background color set to "black" using delegate HOT 1
- Build fail on Swift 4.2
- RTL (right-to-left) languages support HOT 3
- Skip and Continue buttons not working HOT 1
- Can't override page init
- Title not fitting completely in label
- SwiftyOnboardPage isn't setup correctly if the view isn't fullscreen. HOT 2
- Can't Adding pinch and zoom gestures
- Swift Package Manager support? HOT 2
- Cannot subclass SwiftyOnboardOverlay
- Apple's update to their API policy - Required Reason in Privacy manifest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftyonboard.