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

Problems with ShapeCircle Segmented Bar #11

Closed
zvonicek opened this issue Jan 30, 2014 · 4 comments
Closed

Problems with ShapeCircle Segmented Bar #11

zvonicek opened this issue Jan 30, 2014 · 4 comments

Comments

@zvonicek
Copy link
Contributor

I'm having some issues with ShapeCircle Segmented Bar when creating it programmatically. ShapeRectangle and ShapeRoundedRect works fine, but when I change the type to ShapeCircle, segmented bar is not displayed at all.

I suppose it has something to do with calculating cornerRadius in drawIndeterminate method as if I replace line 439 in M13ProgressViewSegmentedBar.m with cornerRadius = _cornerRadius, it solves the issue. However, I'm not sure about the consequences of that.

@Marxon13
Copy link
Owner

Could you link an example. Line 439 is the way it is to make sure that the corner radius is always a circle, by going off the minimum of the width or height.

@zvonicek
Copy link
Contributor Author

Sure, this is the example:

M13ProgressViewSegmentedBar* progressBar = [[M13ProgressViewSegmentedBar alloc] initWithFrame:CGRectMake(10.0, 0.0, 100.0, 20.0)]
progressBar.progressDirection = M13ProgressViewSegmentedBarProgressDirectionLeftToRight;
progressBar.indeterminate = YES;
progressBar.segmentShape = M13ProgressViewSegmentedBarSegmentShapeCircle;

[self.view addSubview:progressBar];

Anyway, I went little bit deeper and found out that the problem was the origin.y coordinate set to 0.0. Segmented Bar is actually placed few pixels above it's y coordinate and therefore in this case it was not visible.
Perhaps it could be improved to respect the y coordinate more accurately.

@Marxon13
Copy link
Owner

Marxon13 commented Feb 3, 2014

I'm not sure what is going on. The only frame setting for the segmented bar is done in initWithFrame:. The only time the subview frames are changed is in layoutSubviews, and their frames are set to the segmented bar's bounds.

Could you link a full project?

@zvonicek
Copy link
Contributor Author

I've commited a sample here: https://github.com/zvonicek/M13ProgressSuite/tree/segmentedBarBug. When you run the app and select the "Segmented Bar" TableView row, there is the new yellow view there. This view has two subviews – two Segmented Bars. Their frame differ only in origin.x coordinate, but the Circle one is apparently upper than the Rectangle one (and actually above the yellow view).

As I said, replacing the line (currently 443) seems to solve it – place the Circle Segmented Bar in a correct position, but I'm not sure about the side effects.

Marxon13 pushed a commit that referenced this issue Apr 7, 2014
Fixed issues from issue #11
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