正多边形的点坐标公式

传送门:How to draw a n sided regular polygon in cartesian coordinates?

先上公式,假设要画正N边型,外接圆的中心点坐标为(x_centre, y_centre)
x[n] = r * cos(2*pi*n/N + theta) + x_centre
y[n] = r * sin(2*pi*n/N + theta) + y_centre

这里如果theta取0,那么画出来是歪的。

想正的话,theta = pi[......]

继续阅读

[转]没有UIViewController时如何使用UIAlertController(让UIAlertController总展示在App最上面)

转载自:《How To Present An Alert View Using UIAlertController When You Don't Have A View Controller》

Over the summer I updated a number of apps to iOS 9. A common tasks for me was replacing the deprecated UIAlertView with new UIAlertController class.[......]

继续阅读