-
[공지] 코드 입력 방법 (등록포인트: 1,000)
코드 입력방법에 알려드립니다. 아래와 같이 코드를 입력하기 위해서는.... [[[UIApplication sharedApplication] setApplicationIconBadgeNumber:12345] // 12345표시 [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0] // 표시안함 에디... -
Xcode 사용하지 않는 시뮬레이터 제거 터미널 명령어
Xcode에서 사용하지않는 시뮬레이터 제거 명령입니다. 대략 10G 정도 제거되던것 같던데 아침에 해보니 40G나 돌아오네요. xcrun simctl delete unavailable 설치된 시물레이터 리스트 보기 xcrun simctl list devices -
모든 알림 한방에 제거하는 터미널 명령어
개발관련은 아니구요. 생활팁입니다. ㅎㅎ 외장하드와 외부모니터를 맥북프로에 연결해서 사용하는데 외부모니터 연결을 끊으면 그동안 외장하드가 붙었다 떨어졌다한 알림이 수백개가 뜹니다. Close 버튼을 5분동안 눌러서 닫아도 끝이 안나길래 찾아보니 ... -
CGRect 의 center 값 구하기
How to get the center of the view https://stackoverflow.com/questions/33745271/how-to-get-the-centre-of-the-view -
스위프트 프로젝트 병렬 컴파일 지원 하기
Xcode 9.2 버전에 시험적으로 추가된 기능입니다. 릴리즈노트에서 밝힌 이 기능의 내용은 다음과 같습니다. 터미널에서 다음코드 적용 $ defaults write com.apple.dt.Xcode BuildSystemScheduleInherentlyParallelCommands Exclusively -bool NO 원래대로 ... -
Xcode 빌드 시간 표시 명령어
1. 터미널에서 아래 명령어를 입력 $ defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES 2. Xcode 재시작 3. 컴파일이 끝난후 빌드타임이 표시됩니다. -
UILabel 깜빡이기, 블링크 효과주기
public extension UILabel { func startBlink() { UIView.animate(withDuration: 0.8, delay:0.0, options:[.autoreverse, .repeat], animations: { ... -
번들에 포함된 이미지 읽을때..
// 번들에 폴더타입으로 이미지폴더를 포함한 경우에 // 이런식으로 UIImage(url: 를 사용하면 안되더라구요... let url = URL(string:Bundle.main.path(forResource: "", ofType: "") UIImage(url: url) // 이 메소드를 사용하세요. UIImage(named: "folder/i... -
Manual Segue 동작 시키는 방법
블로그에 정리해 놓은 것이 있어서 링크로 남김니다. 구현 방법 정리 : http://bongblog.co.kr/18 소스코드 : https://github.com/gellston/SwiftExample/tree/master/ 어떤 처리를 하고 Segue를 동작시키고 싶을때 유용할 듯 하네요 ㅜ -
스위프트 3에서 CGPathMoveToPoint, CGPathAddLineToPoint 변환
// 기존 CGPathMoveToPoint(path, nil, lastPoint.x, lastPoint.y) CGPathAddLineToPoint(path, nil, currentPoint.x, currentPoint.y) // 스위프트 3 path.move(to: CGPoint(x: lastPoint.x, y: lastPoint.y)) path.addLine(to: CGPoint(x: currentPo... -
UIView 에 그림자 생성하는 확장클래스
import UIKit protocol DropShadow {} extension DropShadow where Self: UIView { func addDropShadow () { layer.shadowColor = UIColor.black.cgColor layer.shadowOpacity = 0.7 layer.shadowOffset = CGSize.zero la... -
간단한 UIView 확장클래스입니다.
// 간단한 UIView 확장클래스입니다. // 이렇게 하면 인터페이스빌더에서 값수정이 가능하죠 ㅎ import UIKit extension UIView { @IBInspectable var cornerRadius: CGFloat { set { layer.cornerRadius = newValue laye... -
Hex Color Code를 이용할 수 있게 UIColor 확장하기
// 주로 HTML 색상 코딩시 이용되는 #330A0A와 같은 16진수 컬러코드를 // UIColor에서도 이용할 수 있게 확장합니다. extension UIColor { class func color(fromHex hex: String) -> UIColor? { let hexPattern = try! NSRegularExpression(pat... -
UIColor 확장클래스 랜덤으로 색상뽑아내기
extension UIColor { class func randomColor() -> UIColor { let red = CGFloat(drand48()) let green = CGFloat(drand48()) let blue = CGFloat(drand48()) return UIColor(red: red, green: green, blue: blue, alpha... -
스위프트 3.0 에서 이미지픽커 사용하기 예제
// 스위프트 3.0 에서 이미지픽커 사용하기 예제 class ImagePickerSampleViewController { //카메라 액세스 func handleOpenCamera() { if UIImagePickerController.isSourceTypeAvailable(.camera){ let imagePicker = UI... -
셋팅앱 호출하기 Swift 3.0
// 셋팅앱 호출하기 Swift 3.0 UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!) -
텍스트와 폰트로 CGPath를 만들어봅시다. (for swift 3)
func pathFromCharacter(character char: Character) -> CGPath { let font = CTFontCreateUIFontForLanguage(.system, 30, nil)! let charStr = AttributedString(string: "\(char)", attributes: [kCTFontAttributeName as String : font]) let line = CTLin... -
귀찮은 번들 정보 쉽게 가져옵시다.
#if swift(>=3.0) protocol InfoDictionaryParseable { var valueForMainBundle: AnyObject {get} } extension CFString : InfoDictionaryParseable {} extension String: InfoDictionaryParseable {} extension InfoDi... -
프로젝트에 Cocoapods 설치 및 적용하기
// 터미널을 열고 cocoapods 설치 $ sudo gem install cocoapods // 해당 프로젝트 폴더로 이동후 다음 명령어를 싱행해 Podfile을 생성 $ pod init // Podfile을 열고 추가 프로젝트에 사용할 라이브러리를 추가 platform :ios, '8.0' use_frameworks! target... -
Xcode 자동으로 빌드번호 증가시키기
프로젝트 Build Phases 항목에 Run Script 로 아래코드를 추가한다. #!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") buildNumber=$(($buildNumber + 1)) /usr/libexec/PlistBuddy -c "Set :CFBundleVersio... -
버튼의 이미지 ContentMode 속성 설정방법
// 버튼의 이미지 ContentMode 속성 설정방법 // 이렇게 하면 안됨! [btn setContentMode:UIViewContentModeScaleAspectFill]; // 이렇게 하면 됨! [[btn imageView] setContentMode:UIViewContentModeScaleAspectFill];