2012-11-09 3 views
6
내 컬렉션보기 셀 구조는 내가를 실행하면 cellItemAtIndex, 내가
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 
    UICollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:@"reusedCell" forIndexPath:indexPath]; 


    // Set shadow around the cell 
    [cell.layer setMasksToBounds :NO ]; 
    [cell.layer setShadowColor  :[[UIColor whiteColor ] CGColor ] ];// shadow's color 
    [cell.layer setShadowOpacity :0.65 ];       // set the opacty 
    [cell.layer setShadowRadius  :5.0 ];        // set the blur radius 
    [cell.layer setShadowOffset  :CGSizeMake(0 , 0) ];    // set shadow position 
    [cell.layer setShouldRasterize :YES ];        // tell the cell to render it’s CALayer as a bitmap 
    [cell.layer setShadowPath  :[[UIBezierPath bezierPathWithRect:cell.bounds ] CGPath ] ]; // use a path to draw its shadow instead of using its 
    ...................................................................... 
} 

적용 그림자 내 텍스트가 흐릿하게

를 다음을 수행 들어

enter image description here

다음과 같이 설명

응용 프로그램에서 장치의 그림자가 표시됩니다. 그러나 레이블에 대한 텍스트가 흐릿합니다. 나는 그림자하는 데 사용되는 징조 블록 주석을 제거하면 내 장치

enter image description here

에서 촬영 한 군데 다음에서 봐 주시기 바랍니다 텍스트는 다음과 같은 이미지 enter image description here

I로 분명하다 정말 .... 완전히 잃어버린거야. 누구든지이 문제에 대한 아이디어가 있습니까? 도와주세요

+0

이 중 어떤 것에 대한 아이디어가 있습니까 ??? – tranvutuan

+0

나를 구해 주셨습니다. tnxx 많이 – posha

답변

3

setShouldRasterize, setShadowOffsetsetShadowPath을 삭제합니다. 그것들은 아무런 문제없이 잘 작동 할 것입니다.

8

레이어를 래스터 화하고 있지만 기본 래스터 화 스케일은 1.0입니다. 망막 디스플레이의 경우 2.0으로 설정해야합니다. 그렇지 않으면 레이어가 절반의 해상도로만 표시됩니다.

cell.layer.rasterizationScale=[[UIScreen mainScreen] scale]; 
+0

이것은 정답이어야합니다 :) – mskw

+0

이것은 드롭 그림자를 적용하는 방법을 설명하는 다른 답변에서 빠져있었습니다. 고맙습니다. – guptron