iOS UITableViewCell角半径常数

iOS UITableViewCell角半径常数,ios,uitableview,Ios,Uitableview,我正在扩展UITableView并覆盖setBackgroundView,以便在分组样式表视图中向单元格添加渐变。到目前为止一切都很好 为了将圆角应用于单元格,我将cornerRadius设置为10,看起来大致正确 一切都很好,但我不喜欢硬编码转弯半径的想法。这是Cocoa代码库中的某个常量吗 例如: - (void) setBackgroundView:(UIView *)backgroundView{ NSLog(@"called setBackground"); NSLog(@"

我正在扩展UITableView并覆盖setBackgroundView,以便在分组样式表视图中向单元格添加渐变。到目前为止一切都很好

为了将圆角应用于单元格,我将cornerRadius设置为10,看起来大致正确

一切都很好,但我不喜欢硬编码转弯半径的想法。这是Cocoa代码库中的某个常量吗

例如:

- (void) setBackgroundView:(UIView *)backgroundView{
  NSLog(@"called setBackground");

  NSLog(@"%f", backgroundView.layer.shadowRadius); //yields 0.00000
  NSLog(@"%f", backgroundView.layer.cornerRadius); //yields 3.00000

  CAGradientLayer *gradient = [CAGradientLayer layer];
  [gradient setCornerRadius:10];
  [gradient setMasksToBounds:YES];
  [gradient setBorderWidth:0.8f];
  [gradient setBorderColor:[[UIColor darkGrayColor] CGColor]];
  gradient.frame = backgroundView.bounds;
  gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor greenColor] CGColor], (id)  [[UIColor colorWithRed:.05 green:.65 blue:.05 alpha:1] CGColor],(id)[[UIColor colorWithRed:.05 green:.65 blue:.05 alpha:1] CGColor], (id)[[UIColor colorWithRed:.05 green:.45 blue:.05 alpha:1] CGColor], nil];

  gradient.locations = [NSArray arrayWithObjects: (id)[NSNumber numberWithFloat:0.10], (id)[NSNumber numberWithFloat:0.50], (id)[NSNumber numberWithFloat:0.50], (id)[NSNumber numberWithFloat:1.0], nil];

  [backgroundView.layer insertSublayer:gradient atIndex:0];                        

  [super setBackgroundView:backgroundView]; }

不跟随???为什么不定义自己的常量呢?将UITableViewStyleGrouped应用于UITableViewCell时,会添加一个角半径。此角半径显示为8、9或10。我更喜欢使用与此样式相同的拐角半径,而不是使用我自己的猜测。我假设这是某个地方的常数?