Git Product home page Git Product logo

hhslideview's People

Contributors

herbert77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hhslideview's Issues

slide with more number of segments.

Hi, its a nice Library.
Is there a way to expand the slide view to right when there are more number of segments or elements?
Currently it only supports for few segments and when added more view controllers, then it condense on the same width of view.

simulator screen shot - iphone 7 plus - 2017-12-07 at 23 39 40

Bug when rotate the app

There is a bug when you rotate the app from portrait to landscape, i've fixed it, but didn't send a PR.

adding this code should fix a little it:

- (instancetype)initWithFrame:(CGRect)aFrame {
    self = [super initWithFrame:aFrame];
    if (self) {
        [self initData];
        [self listenOrientationChanges]; //added a notification 
    }
    return self;
}

//also included init with coder, in case someone wants to use with storyboard
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    if ((self = [super initWithCoder:aDecoder])) {
        [self initData];
        [self listenOrientationChanges]; //added a notification 
    }
    return self;
}


-(void)listenOrientationChanges{
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]];
}

- (void)orientationChanged:(NSNotification *)note{
    [self resetViews];
}

-(void)resetViews{
    [[self.slideBar subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    [self addSlideBar];
    [self addButtons];
    [self addSlider];
    // Here still a bug with the slideBar bottom line
}

闪退问题

- (void)createControllerViews {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        self.childControllersArray = [self.dataSource childViewControllersInSlideView:self];
        for (UIViewController *vc in self.childControllersArray) {
            [self.containerView addSubview:vc.view];
            [_controllerViewsArray addObject:vc.view];
        }
    });
}
- (void)layoutControllerViews {
    
    [_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_scrollView);
        make.height.equalTo(_scrollView);
        make.width.equalTo(_scrollView).multipliedBy([_buttonsArray count]);
    }];
    
    for (int i=0; i<[_buttonsArray count]; i++) {
        UIView *view = [_controllerViewsArray objectAtIndex:i];
     
        CGFloat left = self.bounds.size.width * i;
        
        [view mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_containerView);
            make.left.equalTo(_containerView).offset(left);
            make.width.mas_equalTo(self.bounds.size.width);
            make.height.equalTo(_containerView);
        }];
    }
}

dispatch_once 引起数组越界

** [__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array **

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.