2013-11-09 69 views
0

我有一個UITableView中,其中每個細胞是照片,姓名和按鈕,就像在iOS的7手機中的應用程序收藏夾選項卡,然後,就像它是在手機應用程序,我希望圖像在每個細胞中是一個圓,而不是一個正方形。掩蔽的UIImage在TableViewCell

利用一種稱爲PaintCode程序,我已經產生了UIBezierPath我想放置在cell.imageView爲了使圖像看起來就像是一個圓。這裏是代碼

//// Color Declarations 
UIColor* fillColor = [UIColor colorWithRed: 1 green: 1 blue: 1 alpha: 0]; 
UIColor* fillColor2 = [UIColor colorWithRed: 1 green: 1 blue: 1 alpha: 1]; 

//// Bezier Drawing 
UIBezierPath* bezierPath = [UIBezierPath bezierPath]; 
[bezierPath moveToPoint: CGPointMake(36.36, 26.36)]; 
[bezierPath addCurveToPoint: CGPointMake(30.5, 40.5) controlPoint1: CGPointMake(32.45, 30.26) controlPoint2: CGPointMake(30.5, 35.38)]; 
[bezierPath addLineToPoint: CGPointMake(30.5, 20.5)]; 
[bezierPath addLineToPoint: CGPointMake(50.5, 20.5)]; 
[bezierPath addCurveToPoint: CGPointMake(36.36, 26.36) controlPoint1: CGPointMake(45.38, 20.5) controlPoint2: CGPointMake(40.26, 22.45)]; 
[bezierPath closePath]; 
[bezierPath moveToPoint: CGPointMake(70.5, 60.5)]; 
[bezierPath addLineToPoint: CGPointMake(50.5, 60.5)]; 
[bezierPath addCurveToPoint: CGPointMake(64.64, 54.64) controlPoint1: CGPointMake(55.62, 60.5) controlPoint2: CGPointMake(60.74, 58.55)]; 
[bezierPath addCurveToPoint: CGPointMake(70.5, 40.5) controlPoint1: CGPointMake(68.55, 50.74) controlPoint2: CGPointMake(70.5, 45.62)]; 
[bezierPath addCurveToPoint: CGPointMake(64.64, 26.36) controlPoint1: CGPointMake(70.5, 35.38) controlPoint2: CGPointMake(68.55, 30.26)]; 
[bezierPath addCurveToPoint: CGPointMake(50.5, 20.5) controlPoint1: CGPointMake(60.74, 22.45) controlPoint2: CGPointMake(55.62, 20.5)]; 
[bezierPath addLineToPoint: CGPointMake(70.5, 20.5)]; 
[bezierPath addLineToPoint: CGPointMake(70.5, 60.5)]; 
[bezierPath closePath]; 
[bezierPath moveToPoint: CGPointMake(36.36, 54.64)]; 
[bezierPath addCurveToPoint: CGPointMake(50.5, 60.5) controlPoint1: CGPointMake(40.26, 58.55) controlPoint2: CGPointMake(45.38, 60.5)]; 
[bezierPath addLineToPoint: CGPointMake(30.5, 60.5)]; 
[bezierPath addLineToPoint: CGPointMake(30.5, 40.5)]; 
[bezierPath addCurveToPoint: CGPointMake(36.36, 54.64) controlPoint1: CGPointMake(30.5, 45.62) controlPoint2: CGPointMake(32.45, 50.74)]; 
[bezierPath closePath]; 
[fillColor2 setFill]; 
[bezierPath fill]; 
[fillColor setStroke]; 
bezierPath.lineWidth = 1; 
[bezierPath stroke]; 

簡而言之,我不知道如何使用此代碼將此掩碼應用到單元格的圖像視圖。有什麼建議麼?

回答