Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is an issue in iOS7.1 #95

Closed
xieweizhi opened this issue Mar 15, 2015 · 2 comments
Closed

There is an issue in iOS7.1 #95

xieweizhi opened this issue Mar 15, 2015 · 2 comments

Comments

@xieweizhi
Copy link

Thanks @HeshamMegid , this is an awesome open source. But I encountered a problem using this.
Here is how I setup the HMSegmentedControl in viewDidLoad

 _segmentControl = [[HMSegmentedControl alloc] initWithSectionTitles:titles];
    _segmentControl.frame = CGRectMake(0, 0, ScreenWidth, kTopViewHeight);
    _segmentControl.segmentEdgeInset = UIEdgeInsetsMake(0, 10, 0, 10);
    _segmentControl.selectionStyle = HMSegmentedControlSelectionStyleTextWidthStripe;
    _segmentControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
    _segmentControl.verticalDividerEnabled = NO;
    _segmentControl.selectionIndicatorColor = [UIColor blackColor];
    _segmentControl.selectionIndicatorHeight = 2;

    [_segmentControl setTitleFormatter:^NSAttributedString *(HMSegmentedControl *segmentedControl, NSString *title, NSUInteger index, BOOL selected) {
        NSAttributedString *attString = [[NSAttributedString alloc] initWithString:title attributes:@{NSForegroundColorAttributeName : RGBAColor(190.0, 190.0, 190.0, 1.0),
              NSFontAttributeName : [UIFont systemFontOfSize:15.0]}];
        if (selected) {
            attString = [[NSAttributedString alloc] initWithString:title attributes:@{NSForegroundColorAttributeName : [UIColor blackColor],
                                                                                                          NSFontAttributeName : [UIFont systemFontOfSize:15.0]}];
        }
        return attString;
    }];

    __weak typeof(_swipeView) weakSwipeView = _swipeView;
    [_segmentControl setIndexChangeBlock:^(NSInteger index) {
        [weakSwipeView scrollToItemAtIndex:index duration:0.3];
    }];

    [self.view addSubview:_segmentControl];

and I got this error message:

 <Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Why this happens? This is annoying , but nothing harmful right now .

@xieweizhi xieweizhi changed the title There is a bug in iOS7.1 There is an issue in iOS7.1 Mar 15, 2015
@HeshamMegid
Copy link
Owner

This has been fixed in the latest commit on master which hasn't been released as a pod yet. If you point your pod installation to use the latest commit from the master branch, you should no longer see this.

@xieweizhi
Copy link
Author

@HeshamMegid thanks for pointing out ^ ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants