2012-06-12 24 views
5

Masaüstümün yalnızca sağ üst köşelerini ve sol köşelerini karıştırmaya çalışıyorum. ... Bu çalışacaktırUITableView'da yalnızca köşeler nasıl yuvarlanır?

CAShapeLayer *topLayer = [CAShapeLayer layer]; 
UIBezierPath *roundedPath = 
[UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(9.f, 9.0f)];  
topLayer.path = [roundedPath CGPath]; 
+0

http UIBezierPath maskPath

CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame =self.testView.bounds; maskLayer.path = PathToMask.CGPath; 

seti kullanarak bir şekil katmanı maskesi oluşturma oluşturmak için üst köşe yolları bulun: // stackoverflow .com/a/5826698/855738 Bu cevabı hemen hemen aynı şeyi yapmak için kullandım – BBog

+1

Onun eski bir yazı biliyorum ama sadece sahip olduğunuzdan emin olun. [tableView.layer setMasksToBound: YES] ve iyi olmalı ve dandy –

+0

Kabul edilen cevabı gör (burada) [1]. Aynı sorun olabilir. [1]: http://stackoverflow.com/questions/26934231/uiview-in-cell-cant-round-right-hand-corners –

cevap

2

Umut ben aşağıdaki kodu kullanıyorum ve sadece sol üst köşeyi dönen gibi görünüyor. bir maske katmanı

UIBezierPath *PathToMask; 
PathToMask = [UIBezierPath bezierPathWithRoundedRect:self.testView.bounds 
           byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) 
             cornerRadii:CGSizeMake(8.0, 8.0)]; 

maske katmanını maskLayer

self.testView.layer.mask = maskLayer; 
İlgili konular