300x250 iOS119 UIButton 버튼의 테두리 설정 buttonName.layer.borderWidth = 1; buttonName.layer.borderColor = [UIColor colorWithRed:(0/255.0f) green:(176/255.0f) blue:(190/255.0f) alpha:1].CGColor; 버튼 타이틀 정렬 버튼명.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 버튼 이미지 컬러 버튼의 이미지도 내 맘대로 색상을 지정할 수 있다. 버튼 스타일을 custom으로 지정후 tintColor를 수정해주면 되는데, 만약, 변경이 안된다면 Asset -> 해당 이미지의 attribute inspector -> Render As를 'T.. 2022. 9. 28. String 특정 문자 제거 양끝 문자 제거 중간에 있는 문자는 제거 불가능 var helloStr = "Hello!" var iosStr = "#iOS" var swiftStr = "#Swift!" helloStr.trimmingCharacters(in: ["!"])//Hello iosStr.trimmingCharacters(in: ["#"])//iOS swiftStr.trimmingCharacters(in: ["#","!"])//Swift 중간에 있는 문자 제거 var str = "Hello~!@@@, Swift Zedd" str.components(separatedBy: ["~","!","@",",","Swift"])//error!! var str = "Hello~!@@@, Zedd" str.components.. 2022. 9. 22. 햅틱 & 진동 앱을 사용하다 보면 손으로 느껴지는 진동이 있다. 진동과 햅틱에 차이가 있다면 진동은 세기의 정도를 세세히 설정이 불가하지만, 햅틱을 이용하면 띡! 하는 정도를 다양하게 설정이 가능하다 직접 손으로 느껴보는 게 정확하니 실습! 참고: https://babbab2.tistory.com/36 iOS) 진동 울리기 안녕하세요 소들입니다 :) 오늘은 iOS에서 진동 울리기!!! 뭐 .. 특정 버튼을 누른다거나, Foreground에서 알람이 온 경우 뭐 그런 경우에 사용할 수 있겠져!? 1. AudioToolbox Framework 추가해주기 자 진동을 babbab2.tistory.com 1. 프로젝트 - TARGETS - General - Frameworks, Libraries, and Embed.. 2022. 9. 6. 진법 변환 Radix https://developer.apple.com/documentation/swift/int/init(_:radix:) 문자열이나 기수에서 integer 값을 만들어 준다. 10진수 -> 2진수 let num = 78 print(String(num, radix: 2)) // 1001110 2진수 -> 10진수 let num = "1001110" print(Int(num, radix: 2)!) // 78 nonzeroBitCount https://developer.apple.com/documentation/swift/fixedwidthinteger/nonzerobitcount 이진값에서 1의 개수를 알려준다. let num = 78 print(num.nonzeroBitCount) // 4 2022. 8. 31. Alamofire timeout set(Swift5) 참고: https://alamofire.github.io/Alamofire/Classes/SessionDelegate.html https://moonggi-dev-story.tistory.com/7 Alamofire 라이브러리에 timeout 을 달아보자 iOS 대표 라이브러리라 불리는 Alamofire 에 대해 timeout 셋팅을 하고싶었다.. 테스트 결과 기본적으로 1분정도 timeout이 셋팅 되어 있는거 같다. 현재 ARS 같은경우 1분을 훌쩍넘는 시간동안 인증을 한 moonggi-dev-story.tistory.com sessionManager 기본적으로 제공되는 alamofire의 sessionManager의 속성을 커스텀하고 싶을 때 configuration을 이용한다. 네크워크 통신 중 .. 2022. 8. 25. 화면 캡처 방지 안드로이드는 코드 몇 줄이면 스크린의 캡처를 허용할지 말지를 설정해줄 수 있는 반면, iOS는 캡처 방지 설정을 지원 해주지 않는다. 그래서 캡처 되는 순간 다른 화면으로 대체 하여 캡처 되도록 우회 하는 방식을 사용하거나 솔루션을 구입하여 방지 할 수 있다. (솔루션 사용 시 보통 한대당 100 ~ 300만원 정도 책정하는 듯.. 너무 비싸다...) 참고 사이트 1. https://github.com/joonHyoung/preventScreenCapture GitHub - joonHyoung/preventScreenCapture Contribute to joonHyoung/preventScreenCapture development by creating an account on GitHub. github.. 2022. 8. 19. stored property에 'available' 사용하기 스택오버플로우 발췌 - https://stackoverflow.com/questions/41904724/using-available-with-stored-properties Here is one potential solution (thanks to blog post). The idea is to use a stored property with a type of Any and then create a computed property that will cast the stored property (and instantiate it if necessary). private var _selectionFeedbackGenerator: Any? = nil @available(iOS 10.0, *) filepriva.. 2022. 8. 16. 카카오 SDK 설정 https://developers.kakao.com/docs/latest/ko/getting-started/sdk-ios [Kakao Developers 카카오 API를 활용하여 다양한 어플리케이션을 개발해보세요. 카카오 로그인, 메시지 보내기, 친구 API, 인공지능 API 등을 제공합니다. developers.kakao.com](https://developers.kakao.com/docs/latest/ko/getting-started/sdk-ios) 카카오 SDK 설치 (Cocoapods 이용한 방법) 1. Podfile에 작성 후 pod install # 전체 추가 pod 'KakaoSDK' # or # 필요한 모듈 추가 pod 'KakaoSDKCommon' # 필수 요소를 담은 공통 모듈 pod .. 2022. 8. 9. Objectice-C to Swift Migration AppDelegate.swift 생성 1. project - target - Build Setting - Define Module - YES 2. AppDelegate.swift 파일 생성 3. .swift 파일 생성시 프로젝트명-Bridging-Header 생성 옵션창이 같이 뜨니 생성해줄것 4. AppDelegate.h와 .m 파일에 있는 내용을 생성한 swift 파일에 swift문법으로 고쳐 작성 5. AppDelegate class 앞에 @objc 붙여주기 (Objective - C 에서 swift 객체를 인식하기 위함) 6. class 위에 @UIApplicationMain 을 붙여서 AppDelegate.swift 가 main임을 명시 7. 기존의 AppDelegate.h/.m 파일과 main.. 2022. 8. 3. 이전 1 ··· 5 6 7 8 9 10 11 ··· 14 다음 300x250