GithubHelp home page GithubHelp logo

romansorochak / parallaxheader Goto Github PK

View Code? Open in Web Editor NEW
1.0K 19.0 131.0 9.22 MB

Simple way to add parallax header to UIScrollView/UITableView written in Swift.

License: MIT License

Swift 97.66% Ruby 1.45% Objective-C 0.89%
parallax-header tableview scrollview swift ios cocoapods xcode parallaxheader uiscrollview

parallaxheader's People

Contributors

alexeymilakhin avatar itruf avatar iwb-kevin-hirsch avatar kevin-hirsch avatar romansorochak avatar utiko avatar wzbozon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parallaxheader's Issues

clipsToBounds prevents from having overflowing subviews

I'm trying to use ParallaxHeader to create something like this.
but when I use snapkit with the blur+icon example to make half of the icon go beyond the bottom margin, the bottom half of the icon is clipped.

I'm using

roundIcon.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(30)
            make.bottom.equalToSuperview().offset(50)
            make.width.height.equalTo(100)
        }

to align the round icon to the bottom left, like in the image above.
It seems that this code is responsible for the clipping but I understand it is necessary for the blur to happen nicely. Is there a workaround to have subviews go over the margin of the parallaxHeader?

Thanks!

Section header isn't moving with the tableview

when adding section headers and using the Plain style for the tableview the header will remain on the location where it starts before you make the parallax header smaller.

Is there a way to fix this so it moves smoothly with the header?

The header view children is not found on XCUITests

if a do this

let header = TreeLabelsHeaderView()
header.name.text = "Rafael"
header.age.text = "29 years"
header.country.text = "Brasil"
    
tableView.parallaxHeader.view = header
tableView.parallaxHeader.height = 400
tableView.parallaxHeader.minimumHeight = 0
tableView.parallaxHeader.mode = .topFill

// on UITest

let app = XCUIApplication()
XCAssertTrue(app.staticTexts["Rafael"].exists)
XCAssertTrue(app.staticTexts["29 years"].exists)
XCAssertTrue(app.staticTexts["Brasil"].exists)

this test broke and all elements of TreeLabelsHeaderView is not founded on acessibility tree.

Swift 4.2 Compiler Error

Swift 4.2 compiler error:
'NSLayoutFormatOptions' has been renamed to 'NSLayoutConstraint.FormatOptions'

Update Repostory for swift 5

With Swift 5 Xcode suggest me to change things like:
NSLayoutFormatOptions to NSLayoutConstraint.FormatOptions.
NSLayoutAttribute.centerX to NSLayoutConstraint.Attribute.centerX
NSLayoutRelation.equal to NSLayoutConstraint.Relation.equal
bytes: 4, alignedTo: 1 to byteCount: 4, alignment: 1

Tap Response

Is there a way to perform an action when the parralaxHeader is tapped?

Swift 4

The header view label is pushed up too high. Could be a problem with snapKit. They have a swift 4 branch i tried installing by this repo installs 3.2

Scroll To Row results in scrolling to bottom of UITableView

Hi, I'm implementing a comments tableview with a parallax header. To show insertion of comments I'm using scrollToRow but when I use it on a tableView with parallax header, the table is scrolled down to the bottom. I've tested it without parallax header scrolling works exactly as needed. Also my table style is plain and I'm using a section header as a comment having replies as cells. I've tested this in MXParallaxHeader too and it also produces same problem.
Kindly let me know if anything I'm missing here or if you can relate the issue.
Thanks

Compiler error with cocoapods

After install with cocoapods, there is a compiler error Type 'UILayoutPriority' (aka 'Float') has no member 'defaultHigh' in ParallaxHeader.swift Anyone know whats happening?

Cannot Use Header Sections In a UITableView

Using the parallax header with a UITableView that has header sections causes scrolling issues with the header sticking in the view until scrolling to another header section.

class UserHomeViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    var tabBar:TabBar?
    let sections = ["Drafts", "Scheduled", "Past"]
    
    @IBOutlet weak var eventsTableView: UITableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        initUI()
    }
    
    /// Initialize any UI components
    private func initUI(){
        initTableView()
        tabBar = TabBar.init(self.view, navController: self.navigationController!, isVendor: false, selectedTab: 0)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    /// Initialize the trip table view
    fileprivate func initTableView(){
        
        eventsTableView.register(UINib(nibName: "TripTableViewCell", bundle: nil), forCellReuseIdentifier: "TripTableViewCell")
        eventsTableView.rowHeight = 60
               
        eventsTableView.parallaxHeader.view = (Bundle.main.loadNibNamed("ParallaxHeaderView", owner: self, options: nil)![0] as? UIView)!
        eventsTableView.parallaxHeader.height = 120
        eventsTableView.parallaxHeader.minimumHeight = 0
        eventsTableView.parallaxHeader.mode = .topFill
    }
    
    /// Set the number of entries in table view
    /// - parameter tableView: table view we are getting the size of.
    /// - parameter section: section of the table view we are getting the size of.
    /// - returns: the size of the table view.
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
        var size = 0
        
        switch section {
        case 0:
            size = 5
        case 1:
            size = 5
        case 2:
            size = 5
        default:
            size = 0
        }
        
        return size
    }
    
    /// Set the values for the table view cells
    /// - parameter tableView: table view that the cell is being initialized for.
    /// - parameter indexPath: row in the table view that the cell will be placed.
    /// - returns: the initialized table view cell.
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCell(withIdentifier: "TripTableViewCell", for: indexPath) as! TripTableViewCell
        
        return cell
    }
    
    func numberOfSections(in tableView: UITableView) -> Int {
        return sections.count
    }
    
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 30.0
    }
    
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        
        let header = Bundle.main.loadNibNamed("EventsHeaderView", owner: self, options: nil)![0] as! EventsHeaderView
        header.headerLabel.text = sections[section]
        
        return header
    }
}

iOS 10 Status bar issue

Hi All,

I'm having having an issue where the header is shown bellow the status bar.
So the header.y == statubar.maxY.
The tableview's.y == 0. So the content is shown bellow the status bar.
Can anyone help?

Thanks in advance!

Add blur to collection view

Hi
How to add blur to collection view that uses as table header?
If I can't add blur, How to implement images slider?
Thank you

Incorrect height on iOS 11

Hey. On iOS 11, the height of the parallax header is equal to the height that I set + the height of the navigation bar + the height of the status bar. On iPhone 8/8+ height = myHeight + 64, on the iPhone X height = myHeight + 88. On a lower version, iOS is all good. How can this problem be solved?

iPhone X notch problem

Hi,
there is an issues with the notch of the iPhone X, and with section title too.
There is a screenshot:
senza nome

compatible for swift 5

hi there , recently I updated my app and is giving me some syntax changes , I was able to unlock your code to make them, but it would be super awesome If you could take some of your time to make it avalaiable for swift 5 please

ParallaxHeader with UIRefreshControl

Hi

i need to add a UIRefreshControl to the ParallaxHeader. But it always appears above the ParallaxHeader. Is there any way to add the UIRefresfControl above the blur view?
Thanks, Felix

hold header in bottom of UINavigationBar [ iOS 10 ]

Hi, Thanks for this amazing library
i've noticed there's an issue with iOS 10 when scroll to top and when navigation bar is Translucent

You can see the different bellow

iOS 11 - Working correctly
screen shot 2018-02-13 at 10 59 49 am
iOS 10 - has an issue
screen shot 2018-02-13 at 11 00 36 am

parallaxHeader is not working with PaginationManager

I am using PaginationManager for load more functionality.
But after adding parallaxHeader its work perfect but my load more functionality is disable.
Can any one help me how to use parallaxHeader with load more functionality

Scroll To Row results in scrolling to bottom of UITableView

Hi, I'm implementing a comments tableview with a parallax header. To show insertion of comments I'm using scrollToRow but when I use it on a tableView with parallax header, the table is scrolled down to the bottom. I've tested it without parallax header scrolling works exactly as needed. Also my table style is plain and I'm using a section header as a comment having replies as cells.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.