SAStickyHeader icon indicating copy to clipboard operation
SAStickyHeader copied to clipboard

Image is in Front When Table Is Dragged Upwards inside Navigation Bar

Open jaytrixz opened this issue 9 years ago • 21 comments

My image goes in front of my custom table view cells when I drag the table upwards. The table is inside the navigation bar which isn't translucent by the way. Any idea where I'm getting it wrong? Thanks.

jaytrixz avatar Jan 26 '16 12:01 jaytrixz

@jaytrixz can you provide a screenshot?

shams-ahmed avatar Jan 26 '16 14:01 shams-ahmed

Apologies for the late reply. Here are the screenshots:

simulator screen shot jan 27 2016 2 27 54 pm simulator screen shot jan 27 2016 2 28 00 pm simulator screen shot jan 27 2016 2 28 06 pm

jaytrixz avatar Jan 27 '16 06:01 jaytrixz

@jaytrixz Thanks for the screenshot i managed to reproduce this bug, ill need to look for a solution that works

shams-ahmed avatar Jan 28 '16 16:01 shams-ahmed

there bugs in updateImageViewFromScrollEvent method i need to limit it so only expand if the touch is on the header

shams-ahmed avatar Jan 28 '16 16:01 shams-ahmed

Thanks for the update!

jaytrixz avatar Jan 29 '16 02:01 jaytrixz

Ive fixed the issue, can you try validate this with the latest version from master.

pod 'SAStickyHeader', :git => '[email protected]:shams-ahmed/SAStickyHeader.git', :branch => 'master'

shams-ahmed avatar Jan 31 '16 01:01 shams-ahmed

Hi. Sorry for the late reply. I pulled the latest 0.5.1 from Cocoapods and it's still generating me the same issue :(

jaytrixz avatar Feb 02 '16 11:02 jaytrixz

@jaytrixz did you place the above code snippet, it not tagged up yet as i need to confirm bug been resolved

shams-ahmed avatar Feb 02 '16 16:02 shams-ahmed

I tried to paste the above code on my Podfile but it says I don't have access and fails. I just left it without mentioning the branch and link and just did a pod update

jaytrixz avatar Feb 02 '16 22:02 jaytrixz

@jaytrixz ive pushed version 0.6.0 on cocoapods.

shams-ahmed avatar Feb 02 '16 23:02 shams-ahmed

Hi. I've installed 0.6.0 but the behavior changed. It's not zooming anymore when I scroll down and when I scroll up, it still stays in front of the table. :(

This is what I do in my project:

  • In storyboard, I select my UITableView and enable bounce
  • In storyboard, I change my header section height to be 250
  • In my swift file, in my viewForHeaderInSection, I just return SAStickyHeaderView(table: tableView, image: [UIImage(named: "loading_banner")])
  • In my swift file, in my heightForHeaderInSection, I just return 250

That's it. My view controller is embedded from a navigation controller coming from my home view controller.

jaytrixz avatar Feb 03 '16 11:02 jaytrixz

I changed the behaviour to only scroll if touch event is the header, if it finds a table cell then it wont scroll

shams-ahmed avatar Feb 03 '16 11:02 shams-ahmed

Ok. It still has the original issue :(

jaytrixz avatar Feb 03 '16 11:02 jaytrixz

i cant reproduce this, can you provide a sample project please or alter the example project please?

shams-ahmed avatar Feb 03 '16 11:02 shams-ahmed

I'm currently doing that right now...

jaytrixz avatar Feb 03 '16 12:02 jaytrixz

Here's the link to the sample project.

jaytrixz avatar Feb 03 '16 12:02 jaytrixz

Ive looked into the sample code, i going to try create a proper fix soon in the mean time you can apply the header like this:

    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.tableHeaderView = SAStickyHeaderView(frame: CGRect(x: 0, y: 0, width: 320, height: 250), table: tableView, image: [UIImage(named: "loading_banner")])
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        // View doesn't get proper frame in viewDidLoad so adjust it here
        guard var frame = tableView.tableHeaderView?.frame else {
            return
        }

        frame.size.width = CGRectGetWidth(tableView.frame)
        tableView.tableHeaderView?.frame = frame
    }

shams-ahmed avatar Feb 05 '16 10:02 shams-ahmed

Thanks. Will try that and update you.

jaytrixz avatar Feb 05 '16 11:02 jaytrixz

Hi. I just resorted to following this tutorial and doing it manually. It works for me even on Swift 2.2

jaytrixz avatar Mar 28 '16 10:03 jaytrixz

Hi shams, any update for this bug? Cause I can still reproduce this in your sample project. Thank you.

glennposadas avatar Jun 29 '16 00:06 glennposadas

@glennposadas i made some progress on feature/forceTouch branch, but it not 100% solution. ATM am working on another project which is taking alot of my spare time, hopefully i can have a proper look at it soon. however if you come across a solution your welcome to send a pull request.

shams-ahmed avatar Jun 29 '16 01:06 shams-ahmed