[iOS] Draw line
draw line, 즉 선을 그리는 방법입니다.
여러개의 이미지들 사이에 선을 그릴거애요.
이번 프로젝트에서 인물관계도를 표현해야 하는데 사용했던 소스입니다.
draw multi line
소스코드
peopleImgArray = [NSMutableArray arrayWithObjects:image,image1,image2,image3,image4,image5,image6,image7,image8,image9,image10,nil];
for (UIImageView *img in peopleImgArray) {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, image.center.x, image.center.y); //시작지점 설정
CGContextAddLineToPoint(context, img.center.x, img.center.y); //도착지점 설정
CGContextSetLineWidth(context, 1.0f); //라인 굵기
CGContextSetStrokeColorWithColor(context, [UIColor lightGrayColor].CGColor); // 라인 색상
CGContextStrokePath(context);
}
반응형
'IT > iOS' 카테고리의 다른 글
[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 |
UICollectionview cell selection (0) | 2014.09.15 |
[iOS] 원 이미지 만들기 (0) | 2014.08.12 |
UIButton title multi-line (0) | 2014.08.08 |
UILabel text size height (0) | 2014.08.05 |
프로젝트 개발과정 (0) | 2014.08.05 |