ํฌ๋ช ํ ๊ตฌ๋ฉ์ ๊ฒฝ์ฐ ๋ค์์ ์ํํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
*Note: Use holeTransparent with holeColor = nil to make the hole transparent.*```
๊ทธ๋ฌ๋ ๋ค์ ์ค์ ์ผ๋ก ์ธํด ์ถฉ๋์ด ๋ฐ์ํฉ๋๋ค.
pieChart.holeTransparent = true
pieChart.holeColor = nil
๊ตฌํ์ ์ดํด๋ณด๋ฉด holeColor๋ ๋ช ์ ์ ์ผ๋ก ์ธ ๋ํ๋ฉ๋๋ค. ์๋ง๋ ๊ทธ ์์ ์ค๋ nil์ ๋ํ ๊ฒ์ฌ ๋๋ฌธ์ผ ๊ฒ์ ๋๋ค. ๊ทธ๋ฌ๋ ๋ช ์ ์ ์ธ ๋ํ์ ๊ฒ์ฌ ๋ฒ์์ ํฌํจ๋์ง ์์ต๋๋ค.
if (holeColor !== nil && holeColor != UIColor.clearColor())
{
// draw the hole-circle
CGContextSetFillColorWithColor(context, holeColor!.CGColor)
CGContextFillEllipseInRect(context, CGRect(x: center.x - holeRadius, y: center.y - holeRadius, width: holeRadius * 2.0, height: holeRadius * 2.0))
}
// only draw the circle if it can be seen (not covered by the hole)
if (transparentCircleRadiusPercent > holeRadiusPercent)
{
let alpha = holeAlpha * _animator.phaseX * _animator.phaseY
let secondHoleRadius = radius * transparentCircleRadiusPercent
// make transparent
CGContextSetFillColorWithColor(context, holeColor!.colorWithAlphaComponent(alpha).CGColor)
// draw the transparent-circle
CGContextFillEllipseInRect(context, CGRect(x: center.x - secondHoleRadius, y: center.y - secondHoleRadius, width: secondHoleRadius * 2.0, height: secondHoleRadius * 2.0))
}
์์ ํด๊ฒฐ ๋ฐฉ๋ฒ :
pieChart.holeColor = UIColor.clearColor()
๋น์ ์ด ์ฌ๋ฐ๋ฅธ์ง :-)
!
๊ฐ ์ผ๋ง๋ ์์ ํ์ง ์์์ง ๋ช
ํํ์ง ์์๋ Swift ์ด์ฐฝ๊ธฐ๋ถํฐ ์ฌ์ ํ !
๋ค์ด ์์ต๋๋ค.
๊ทธ๋ค ๋๋ถ๋ถ์ ์ด์ ์ฌ๋ผ์ก์ต๋๋ค, ์ ์๊ฒ ๊ฐ์ฌํฉ๋๋ค!
๋น์ ์ด ์๋ฏธํ๋ ๊ฒ ๊ฐ์์
If let god = god {
thank(god)
}
๊ทธ๊ฒ์ ํ ์คํธํ๊ธฐ๋ฅผ ๊ธฐ๋ํฉ๋๋ค!
๐
๊ตฌ๋ฌธ ์ค๋ฅ์
๋๋ค. lowerCase if
;-)์ด์ด์ผํฉ๋๋ค.
ํน์ ์ฌ๋ผ์ด์ค์ ํด๋นํ๋ ์ํ ์ฐจํธ (์ : holecolor) ๋ด์ ์์ ๊ทธ๋ฆผ์๋ฅผ ํฌํจํด์ผํฉ๋๋ค. ์ด๋ป๊ฒ ํ ์ ์์ต๋๊น?
์ํ ์ฐจํธ์์ ์ด๋ฏธ์ง๋ฅผ ๋ง๋ค๊ธฐ ์ํด ์ฆ์ ๋ ์ด๋ธ์ ๊ตฌํํ๋ ๋ฐฉ๋ฒ
์ค์ํํธ 4
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๊ตฌ๋ฌธ ์ค๋ฅ์ ๋๋ค. lowerCase
if
;-)์ด์ด์ผํฉ๋๋ค.