본문 바로가기 메뉴 바로가기

권말련의 게임 블로그

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

권말련의 게임 블로그

검색하기 폼
  • 분류 전체보기 (1308) N
    • 로스트아크 (574)
      • 대항해 (126)
      • 모험의 서 (75)
      • 모코코(대륙) (119)
      • 기억의 오르골 (18)
      • 업적 (27)
    • 게임 (448) N
      • 리니지TL (2)
      • 팔월드 (21)
      • 디아블로4 (43)
      • 마인크래프트 (4)
      • 몬스터 헌터 와일즈 (1)
      • 엘든링 (151)
      • 오딘 (22)
      • 아이온 클래식 (75)
      • 포켓몬고 (26)
      • 바람의 나라:연 (24)
      • AFK아레나 (45)
      • 오버워치 (6) N
      • 배틀그라운드 (2)
      • RPG게임 (7)
      • 모바일게임 (17)
    • 모바일게임 쿠폰 (3) N
    • IT (201)
      • iOS (67)
      • Android (38)
      • PHP + Mysql (7)
      • AWS+Window Server (5)
      • 블로그 (32)
    • 일상 (76)
      • 맛집 (8)
      • 운동 (15)
      • 여행 (4)
      • 리뷰 (9)
  • 방명록




티스토리 뷰

IT/iOS

UICollectionview cell selection

권말련 2014. 9. 15. 17:47

UICollectionview cell selection


UICollectionview cell 선택시 효과를 주는 방법입니다.

저는 셀 선택시 테두리에 색을 입히는 방법을 썼습니다.



int selectedCellIndex; 선언


- (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath

{

   

    MiddleCell* cell = (MiddleCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"MiddleCell" forIndexPath:indexPath];

    

    if (selectedCellIndex == indexPath.row) {

        

        cell.layer.borderWidth = 2.0;

        cell.layer.borderColor = [UIColor colorWithRed:0.965 green:0.427 blue:0.196 alpha:1.000].CGColor;

        

    }

    else

    {

        cell.layer.borderWidth = 0.0;

    }


return cell;

}


- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath

{

    selectedCellIndex = (int)indexPath.row;

}


셀 선택 후 collectionview reloadData 하는것도 잊지마세요.


반응형
그리드형
저작자표시 (새창열림)

'IT > iOS' 카테고리의 다른 글

[iOS] UIView 부분적으로 라운드 적용하기  (2) 2015.05.19
[iOS] 앱평가 하기, 리뷰 남기기는 iRate로  (0) 2015.03.30
iOS8 버그 unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow  (0) 2014.11.06
iOS8 푸쉬 등록 에러메세지 (registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later)  (0) 2014.10.02
[iOS] Draw line  (0) 2014.08.13
[iOS] 원 이미지 만들기  (0) 2014.08.12
UIButton title multi-line  (0) 2014.08.08
UILabel text size height  (0) 2014.08.05
  • 카카오톡 공유하기
  • 네이버 블러그 공유하기
  • 페이스북 공유하기
  • 트위터 공유하기
  • 구글 플러스 공유하기
  • 카카오스토리 공유하기

댓글
반응형
공지사항
최근에 올라온 글
Total
Today
Yesterday

Blog is powered by Tistory / Designed by Tistory

티스토리툴바