Giter Site home page Giter Site logo

Comments (13)

sunnyyoung avatar sunnyyoung commented on August 19, 2024

Same problem

from mxparallaxheader.

YanSte avatar YanSte commented on August 19, 2024

i try the try catch form but not work

from mxparallaxheader.

maxep avatar maxep commented on August 19, 2024

Can you give a bit more context ? I cant reproduce on samples. Are you adding the parallax header to a UITableView ? I've made some changes recently that may have introduce this bug.

This does not work ? :

- (void)willMoveToSuperview:(UIView *)newSuperview {
    @try  {
        [self.superview removeObserver:self.parent forKeyPath:NSStringFromSelector(@selector(contentOffset)) context:kMXParallaxHeaderKVOContext];
    } @catch (NSException *exception) {}
}

Can you try this ? :

- (void)willMoveToSuperview:(UIView *)newSuperview {
    if (self.parent) {
        [self.superview removeObserver:self.parent forKeyPath:NSStringFromSelector(@selector(contentOffset)) context:kMXParallaxHeaderKVOContext];
    }
}

- (void)didMoveToSuperview {
    if (self.parent) {
        [self.superview addObserver:self.parent
                         forKeyPath:NSStringFromSelector(@selector(contentOffset))
                            options:NSKeyValueObservingOptionNew
                            context:kMXParallaxHeaderKVOContext];
    }
}

Thanks for the report.

from mxparallaxheader.

silvanosouzajunior avatar silvanosouzajunior commented on August 19, 2024

same problem here

from mxparallaxheader.

leolelego avatar leolelego commented on August 19, 2024

@maxep the try/catch doesn't fix.

The second proposition give this :

2016-06-18 at 20 11 26

from mxparallaxheader.

wade0595 avatar wade0595 commented on August 19, 2024

same problem here

leave the view

libc++abi.dylib: terminate_handler unexpectedly threw an exception

from mxparallaxheader.

maxep avatar maxep commented on August 19, 2024

Is v0.5.0 has this issue ? are you adding a parallax header to a table view?

from mxparallaxheader.

leolelego avatar leolelego commented on August 19, 2024

@maxep yes, this is a tableview from me, with static cell. And the app crash when I pop to the view before (UInavigationBar back button).

from mxparallaxheader.

silvanosouzajunior avatar silvanosouzajunior commented on August 19, 2024

on the version v0.5.0 is working well

2016-06-20 14:54 GMT-03:00 Léo Derbois [email protected]:

@maxep https://github.com/maxep yes, this is a tableview from me, with
static cell. And the app crash when I pop to the view before
(UInavigationBar back button).


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#28 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ALLOfxCFXh9eaR6A8gmSs5ZOvseOW5ZEks5qNtPFgaJpZM4I11FO
.

from mxparallaxheader.

leolelego avatar leolelego commented on August 19, 2024

@maxep I just tried like this : pod 'MXParallaxHeader','= 0.5.0' And the crash was not in this release.

from mxparallaxheader.

developforapple avatar developforapple commented on August 19, 2024
- (void)willMoveToSuperview:(UIView *)newSuperview {
    [self.superview removeObserver:self.parent forKeyPath:NSStringFromSelector(@selector(contentOffset)) context:kMXParallaxHeaderKVOContext];
}

- (void)setTableHeaderViewFrame:(CGRect)frame {

    //Create a table header view that will raise KVO
    MXParallaxView *headerView = [[MXParallaxView alloc] initWithFrame:frame];
    headerView.parent = self;

    [headerView addSubview:self.contentView];
    [(UITableView *)self.scrollView setTableHeaderView:headerView];
    [headerView setNeedsLayout];
}

Conflict between the 2 methods above.
self.contentView's class is MXParallaxView
[headerView addSubview:self.contentView]; self.contentView's superView class also is MXParallaxView.

So [self.superview removeObserver:self.parent forKeyPath:NSStringFromSelector(@selector(contentOffset)) context:kMXParallaxHeaderKVOContext]; make crash.

My Code:

- (void)willMoveToSuperview:(UIView *)newSuperview {
    if ([self.superview isKindOfClass:[UIScrollView class]]) {
        [self.superview removeObserver:self.parent forKeyPath:NSStringFromSelector(@selector(contentOffset)) context:kMXParallaxHeaderKVOContext];
    }
}

- (void)didMoveToSuperview {
    if ([self.superview isKindOfClass:[UIScrollView class]]) {
        [self.superview addObserver:self.parent
                     forKeyPath:NSStringFromSelector(@selector(contentOffset))
                        options:NSKeyValueObservingOptionNew
                        context:kMXParallaxHeaderKVOContext];
    }
} 

from mxparallaxheader.

jj-12 avatar jj-12 commented on August 19, 2024

Good fix, but are there any plans of getting this into the next release of MXSegmentedPager?

from mxparallaxheader.

maxep avatar maxep commented on August 19, 2024

Fix by #31

from mxparallaxheader.

Related Issues (20)

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.