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

How to move rollingview start point #8

Open
Beautistar opened this issue May 7, 2020 · 5 comments
Open

How to move rollingview start point #8

Beautistar opened this issue May 7, 2020 · 5 comments

Comments

@Beautistar
Copy link

image

How can I remove or extend this line to the end of left and move visualier starting point to move at the right of edge?

@rheyansh
Copy link

@Beautistar Did you find any solution?

@Beautistar
Copy link
Author

Yes

@rheyansh
Copy link

@Beautistar Could you please share the solution. Thanks in advance!

@Beautistar
Copy link
Author

image

File replace

#import "DPRollingEqualizerView.h"

@implementation DPRollingEqualizerView

#pragma mark - Drawing

  • (void)drawRect:(CGRect)rect {

    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSaveGState(ctx);
    CGRect frame = self.bounds;

    [(UIColor *)self.backgroundColor set];
    UIRectFill(frame);

    CGFloat columnWidth = (rect.size.width) / (self.equalizerSettings.numOfBins - 1);

    CGFloat actualWidth = MAX(1, columnWidth (1 - 2 self.equalizerSettings.padding));
    CGFloat actualPadding = MAX(0, (columnWidth - actualWidth) / 2);

    for (NSUInteger i = 0; i < self.equalizerSettings.numOfBins; i++) {
    CGFloat columnHeight = [[self.audioService timeHeights][i] floatValue] / 2;

      if (columnHeight <= 0)
          continue;
      CGFloat columnX = i * columnWidth;
    
      UIBezierPath *rollingPath = [[UIBezierPath alloc] init];
      rollingPath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(columnX + actualPadding,
                                                                      CGRectGetHeight(frame)/2 - columnHeight/2,
                                                                      actualWidth,
                                                                      columnHeight)
                                               cornerRadius: actualWidth];
    
      [self.equalizerBinColor setFill];
    
      [rollingPath fill];
    

    }

    [self.equalizerBinColor setStroke];

// UIBezierPath *linePath = [UIBezierPath bezierPath];
//
// linePath.lineWidth = 2.0;
// [linePath moveToPoint: CGPointMake(CGRectGetWidth(rect) / 2 + actualPadding, CGRectGetHeight(rect) / 2)];
// [linePath addLineToPoint: CGPointMake(CGRectGetWidth(rect), CGRectGetHeight(rect) / 2)];
// [linePath stroke];

// CGContextRestoreGState(ctx);
}

@EnD

@rheyansh
Copy link

Thanks @Beautistar It helped a lot

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