CollectionView单元格圆角不起作用

时间:2018-02-11 19:34:59

标签: ios swift uicollectionview uicollectionviewcell

我有一个原型单元用于集合视图,我试图使边缘四舍五入,但我无法弄清楚如何使用self.layer.cornerRadius = 3.0并使其工作。谁能告诉我我做错了什么?

#!/usr/bin/perl
use strict;
use warnings;

open IN2, '<', \<<EOF;
**9999**,Position,West
**9998**,Position,West
**9997**,Position,South
**1111**,Position,South
**9999**,Time,Morning
**9997**,Time,Afternoon
EOF

my %hash;

while ( <IN2> ) {
     chomp;
     my @col2 = split ","; 
     $hash{$col2[0]}{$col2[1]} = $col2[2]; 
} 

open IN1, '<', \<<EOF;
abc1111,1070X00Y0,**9999**,B
abc2222,1070X00Y0,**9999**,B
abc3333,1070x00Y0,**9999**,B
EOF

while ( <IN1> ) { 
    chomp;
    my $key = (split /,/)[2];
    if ( exists( $hash{$key} ) ) { 
        print join(",", $_, @{ $hash{$key} }{ qw/Position Time/ }), "\n";
    }
} 

1 个答案:

答案 0 :(得分:1)

最好在contentView中创建一个subView并将角应用到它

self.contentView.layer.cornerRadius = 2.0

self.contentView.clipsToBounds = true