300x250 전체 글241 UITabBar 선택된 아이템 컬러 변경 Tab bar controller의 탭바 선택 - identity Inspector - User Defined Runtime Attributes tintColor = 선택된 아이템 색상 unSelectedItemTintColor = 선택되지 않은 아이템 색상 코드로 title 속성 변경 let baselineOffset = (height - font lineHeight) / 4 let style = NSMutableParagraphStyle() style.maximumLineHeight = height style.minimumLineHeight = height) let tabBarAppearance = UITabBarAppearance () let tabBarItemAppeara.. 2022. 10. 19. UIscrollView dynamic height 스크롤뷰의 높이를 컨텐츠에 맞게 설정하는 방법! scrollview의 subview의 frame을 'CGRectUnion' 함수를 이용하여 설정할 수 있다. CGRect contentRect = CGRectZero; for (UIView *view in self.scroll.subviews) { for (UIView * content in view.subviews) { contentRect = CGRectUnion(contentRect, content.frame); } } self.scroll.contentSize = contentRect.size; 참고 : https://stackoverflow.com/questions/2944294/how-do-i-auto-size-a-uiscrollview-to-f.. 2022. 10. 14. 특정 viewcontroller로 pop 방법1. NSArray * vcStack = self.navigationController.viewControllers; NSInteger index = vcStack.count - 1; while (YES) { index--; UIViewController *vc = [vcStack objectAtIndex:index]; if([vc isKindOfClass:[원하는VC class]]){ [self.navigationController popToViewController:vc animated:YES]; return; } } 방법2. let controllers = self.navigationController?.viewControllers for vc in controllers! { if vc is A.. 2022. 10. 13. Animation 밑에서 천천히 올라오는 팝업창 구현 스토리보드 오토레이아웃 제약을 이용하여 구현하는 방식 1. 올라올 뷰를 뷰컨트롤러 화면보다 밑으로 배치 2. 팝업창의 bottom 제약조건을 outlet으로 연결 3. superView는 배경색을 clear Color로 설정 4. 팝업 애니메이션 코드 작성 superView는 투명한 검정색으로 팝업뷰(datePickerBackViewBottom)는 밑에서 위로 올라오도록 레이아웃 값 변경 func show() { UIView.animate(withDuration: 0.3, animations: { self.view.backgroundColor = UIColor(displayP3Red: 0, green: 0, blue: 0, alpha: 0.6) }) UIView.ani.. 2022. 10. 11. 지도앱 URL Scheme 카카오맵 : https://apis.map.kakao.com/ios/guide/#urlscheme_open_mapapp 카카오앱에 원하는 주소로 바로 이동하여 실행 시키고 싶다면, '좌표로 이동' 부분의 URL Scheme을 이용하면 된다. kakaomap://look?p=좌표LAT,좌표LNG 카카오네비 : https://developers.kakao.com/docs/latest/ko/kakaonavi/ios 카카오네비는 다른앱과 달리 URL Scheme으로 열리지 않아서 API연결하여 사용해야 한다. -> 참고: https://devtalk.kakao.com/t/ios-kakao-navi-url-scheme/109747/2 네이버지도 : https://guide.ncloud-docs.com/docs/n.. 2022. 10. 5. UICollectionView 페이징 컬렉션뷰를 이용해서 컨텐츠를 보여줄 때 컬렉션뷰를 스크롤 할 때 하나씩(원하는 만큼) 넘어가도록 만들고 싶을 때 , scrollViewWillEndDragging 함수를 이용하여 처리 할 수 있다. @interface ViewController () { NSInteger currentItemIndex; } @end - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { //좌우 목록 콜랙션 뷰일 때만 if (scrollView == self.컬렉션뷰) { UICollectionViewFlowL.. 2022. 9. 30. 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. 이전 1 ··· 8 9 10 11 12 13 14 ··· 27 다음 300x250