반응형

UIView 4

[Swift / Obejctive-c] UIView를 UIImage로 변환하기 (render UIView to UIImage)

Swift, Objective-C에서 UIImage를 UIImage로 변환하는 방법 (render UIView to UIImage) Swift func viewToImage(view: UIView) -> UIImage { let renderer = UIGraphicsImageRenderer(size: view.bounds.size) let image = renderer.image { context in view.drawHierarchy(in: view.bounds, afterScreenUpdates: true) } return image } Objective-c - (UIImage*)viewToImage:(UIView*)view { UIGraphicsImageRenderer *renderer = [[UI..

[Swift] CustomView 사용하기 (ReusableView, 재사용 가능한 뷰)

CustomView, ReusableView, 재사용 가능한 뷰 사용하는 방법 공통적으로 쓰이는 View를 1개 만들어서, 여러 화면(ViewController)에서 사용할 수 있는 방법입니다. Github Sample https://github.com/eunsuu1015/SwiftSample/tree/master/ReusableView GitHub - eunsuu1015/SwiftSample Contribute to eunsuu1015/SwiftSample development by creating an account on GitHub. github.com 목차 1. ReusableView 생성 a. ReusableView.swift 생성 b. ReusableView.xib 생성 2. ReusableV..

[objective-c] UIView 그라데이션 넣기 (CAGradientLayer)

UIView에 gradient 넣는 방법 일반적으로 두 가지 색상으로 가로 또는 세로 그라데이션을 넣는 방법이다. 가로 그라데이션과 세로 그라데이션 적용 방법 Utils.m +(void)setVerticalGradient:(id)viewId topColor:(UIColor*)topColor bottomColor:(UIColor*)bottomColor { [self setGradient:viewId isVertical:YES firstColor:topColor secondColor:bottomColor]; } +(void)setHorizontalGradient:(id)viewId leftColor:(UIColor*)leftColor rightColor:(UIColor*)rightColor { [self s..

반응형