maxep / MXParallaxHeader

Simple parallax header for UIScrollView
MIT License
1.73k stars 251 forks source link

MXParallaxHeader Swift version not working at all #27

Closed vjujjavarapu-zz closed 8 years ago

vjujjavarapu-zz commented 8 years ago

Hi,

I have added a basic MXSegmentedPagerController with two pages with a Table and Web Controller and it is crashing right away with this error. 'NSInvalidArgumentException', reason: '*\ setObjectForKey: object cannot be nil (key: 0)' . if i debug i crash occurs inside this method "[self.pager reloadData] "

I have attached the sample project on this. So I hope someone can resolve this. The MXParallaxHeader looks amazing however if i can't use it in Swift , then there is no point. MXParallaxView-Swift.zip

maxep commented 8 years ago

Hi @vjujjavarapu

You are wrongly setting the segue identifiers. Your VJViewController will look for the defaults identifiers format, as mx_page_0, mx_page_1, mx_page_.... You can rather renaming your segue identifiers using the default format, or override the following method :

override func segmentedPager(segmentedPager: MXSegmentedPager, segueIdentifierForPageAtIndex index: Int) -> String {
        return ["vj_table", "vj_web"][index];
    }
vjujjavarapu-zz commented 8 years ago

@maxep You are the best. And One last question. Can i increase the height of the Parallax Header, So that its height is all the way extended till the middle of the screen ?

vjujjavarapu-zz commented 8 years ago

@maxep no worries i figured it out. your prompt response made me use your app. I would later make a pull request and make your parallax header better. Cheers mate.