DisPlayers-Audio-Visualizers
DisPlayers-Audio-Visualizers copied to clipboard
How to move rollingview start point
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?
@Beautistar Did you find any solution?
Yes
@Beautistar Could you please share the solution. Thanks in advance!
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
Thanks @Beautistar It helped a lot