algospot : drawrect : python
python을 공부할 겸 algospot에 있는 문제들을 해결해 보기로 하였습니다. 올라온 다른 답안들에 비해 아직 부족한 부분이 있지만 점차 나아질 것으로 믿고 지속적으로 해결해보려 합니다. 문제 : https://algospot.com/judge/problem/read/DRAWRECT
해결:
https://gist.github.com/591a430235d8de9249c4
seen from Canada
seen from United Kingdom
seen from Netherlands
seen from France

seen from United States

seen from Poland
seen from France
seen from Brazil
seen from Italy
seen from Canada
seen from United States
seen from United Kingdom

seen from Finland
seen from China

seen from United States
seen from Malaysia

seen from Australia

seen from United Kingdom

seen from Australia
seen from Germany
algospot : drawrect : python
python을 공부할 겸 algospot에 있는 문제들을 해결해 보기로 하였습니다. 올라온 다른 답안들에 비해 아직 부족한 부분이 있지만 점차 나아질 것으로 믿고 지속적으로 해결해보려 합니다. 문제 : https://algospot.com/judge/problem/read/DRAWRECT
해결:
https://gist.github.com/591a430235d8de9249c4
drawRect depends on Views -> On Startup Custom View uses wrong frames
drawRect depends on Views -> On Startup Custom View uses wrong frames
My view hierachy looks like this: (I use Autolayout)
ContentView
CustomView (implements drawRect)
Button
TableView
In the drawRect of the CustomView I draw a UIBezierPath from the top to the bottom through all CustomView.SuperView.subViews where the line stops if a Frame is in the way and begins to draw further till the next frame and so on.
On Startup when the DrawRect is called the Viewsare…
View On WordPress
iOS Draw radial gradient on Arc
CGContextSaveGState(ctx);
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, center.x, center.y);
CGContextAddArc(ctx, center.x, center.y, radius, startAngle, (startAngle + angle), NO);
CGContextClosePath(ctx);
CGContextClip(ctx);
UIColor *color = self.colorList[i];
NSArray *colors = @[ (id)self.baseColor.CGColor, (id)color.CGColor ];
CGFloat locations[2] = { 0.f, 1.f };
CGGradientRef arcGradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)colors, locations);
CGContextDrawRadialGradient(ctx, arcGradient, center, 0, center, radius, 0);
CGContextRestoreGState(ctx);
startAngle += angle;