andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 634 forks source link

Objective C support for iPhone X #300

Closed ZaeemZafar closed 6 years ago

ZaeemZafar commented 6 years ago

Hi,

I was previously using objective-c version of AMScrolling 1.x in my project. Everything was working correctly. But iPhone X has a lot of issues when it comes to support my app for this device. I then integrated latest code 4.x and tried to implemented it in my existing objective-c project. I am unable to subclass from 'ScrollingNavigationController' neither from storyboard nor programmetically. As Swift classes are not supposed to be subclassed in objective-c code.

Any help will be highly appreciated!

andreamazz commented 6 years ago

Hi @ZaeemZafar why do you need to subclass it?

ZaeemZafar commented 6 years ago

Hi andrea,

Thanks for the quick reply.

Subclassing is necessary as per your provided readme file.

Besides, if I don’t subclass it then I receive runtime error ‘followScroll: — unrecognized selector sent to instance ’

I can share my sample objective-c project which I using as a proof of concept.

Regards, Zaeem Zafar

On 14-Feb-2018, at 6:59 PM, Andrea Mazzini notifications@github.com wrote:

Hi @ZaeemZafar why do you need to subclass it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

andreamazz commented 6 years ago

You don't have to subclass ScrollingNavigationController, you need to use ScrollingNavigationController as your navbar. Now that you mention it, I realize that it's poorly worded in the readme, I'll update that. Anyhoo, just use ScrollingNavigationController instead of UINavigationController.

ZaeemZafar commented 6 years ago

testXcode9.zip

I am now using ScrollingNavigationController in my Storyboard and '[(ScrollingNavigationController *)self.navigationController followScrollView:self.tableView delay:50.0f];' this code seems to be executing. But there is no effect on navigation bar (not an inch). Please find attachment of my sample project(Everything is in place, please take a look on it when possible)

it again seems to be linked with Objective-c integration problem otherwise I would have created a new issue for this.

I really appreciate your help & support. Thanks

ZaeemZafar commented 6 years ago

Looking forward to your reply. Thanks

andreamazz commented 6 years ago

Hi @ZaeemZafar I took a look at your sample, you forgot to connect the tableView outlet. Also, the navbar needs to follow a scrollable view, you are initializing it against you main view. Change the call to this:

[(ScrollingNavigationController *)self.navigationController followScrollView:self.tableview delay:0 scrollSpeedFactor:1 collapseDirection:-1 followers:@[]];
ZaeemZafar commented 6 years ago

@andreamazz my bad. Many thanks.