테이블 뷰의 각 셀에 특정 그라디언트 색상을 추가하려고합니다. 지금까지 내가 해왔 던 모든 작업은 각 셀에 대한 그래디언트로 설정됩니다. 나는 광산에 가까운 다른 게시물을 찾았지만 행 번호를 결정하고 행 번호가 쌍을 이루는 지 여부에 따라 특정 색상을 지정함으로써 행을 번갈아 바꾸는 두 가지 색상 만 설정합니다. 여기에 link이 있습니다. 다음은 각 셀의 그래디언트에 사용하는 코드입니다. 그라디언트의 각 색상을 셀에 대신 표시하려면 어떻게해야합니까?TableView의 각 셀 (또는 행)에 그라데이션의 색을 어떻게 추가합니까?
CAGradientLayer *grad = [CAGradientLayer layer];
grad.frame = cell.bounds;
grad.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithRed:252/255.f green:135/255.f blue:208/255.f alpha:1] CGColor], (id)[[UIColor colorWithRed:253/255.f green:91/255.f blue:105/255.f alpha:1] CGColor], nil];
[cell setBackgroundView:[[UIView alloc] init]];
[cell.backgroundView.layer insertSublayer:grad atIndex:0];
고마워요!
http://stackoverflow.com/questions/30478975/how-to-set-multiple-gradient-colour-in-uitableviewcell-using-cagradientlayer-in –