본문 바로가기

모바일/IOS35

키보드관련 //키보드 우측하단키 return 클릭시 //스토리보드에서 텍스트필드에 마우스 오른쪽 클릭후 delegate를 viewcontroller에 연결 func textFieldShouldReturn(_ textField: UITextField) -> Bool { //print(textField.text!) //키보드를 내린다. textField.resignFirstResponder() return true } //숫자형태의 키보드의 경우 return버튼이 존재하지않는다. //화면영역 클릭시 키보드가 사라지게 override func touchesBegan(_ touches: Set, with event: UIEvent?) { self.view.endEditing(true) } ScrollView에서 touch.. 2018. 2. 9.
UIAlertController, UIAlertAction //1. 알람창 형식 정의 let alert = UIAlertController(title: "로그인", message: "로그인 하시겠습니까?", preferredStyle: .alert) //2. 버튼정의 let okAction = UIAlertAction(title: "확인", style: .default, handler: {(UIAlertAction) in }) let cancelAction = UIAlertAction(title: "취소", style: .cancel) //3. 버튼을 알림창 객체에 추가 alert.addAction(okAction) alert.addAction(cancelAction) self.present(alert,animated: true) 액션시트부분 let alert .. 2018. 2. 9.
button에 이벤트 추가 1. IBOutlet추가 @IBOutlet var detail01Button: UIButton! @IBOutlet var detail02Button: UIButton!2. 셀에서 버튼을 가져온다는 가정하에 page02cell.detail01Button.tag = 0 page02cell.detail01Button.addTarget(self, action: #selector(detailButtonClick(_:)), for: .touchUpInside) addTarget을 통해서 이벤트 등록 및 함수 지정 3. 함수영역swift문법 업데이트되면서 @objc 부분을 붙여줘야함 @objc func detailButtonClick(_ sender: UIButton){ if sender.tag == 0 { }els.. 2018. 1. 30.
URL 을 받아올때 nil값이 넘어온다. 파일명2018-01-23 09;20;24_4(14).png경로 + 해당 파일명이 넘어올때 리턴값이 nil값이 넘어온다 https://stackoverflow.com/questions/3439853/replace-occurrences-of-space-in-url var urlString = originalString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) var urlString = originalString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) https://developer.apple.com/documentatio.. 2018. 1. 25.
ScrollVIew에서 가로스크롤 막기 https://stackoverflow.com/questions/32197630/disabling-horizontal-scrolling-from-uiscrollview-swift 해당클래스에 스크롤뷰 Delegate를 추가한다. UIScrollViewDelegate func scrollViewDidScroll(_ scrollView: UIScrollView) { if scrollView.contentOffset.x>0 { scrollView.contentOffset.x = 0 } } 2018. 1. 24.
TableCell 선택시 페이지 이동 Segue StoryBoard에 TableView를 만들었긴했는데cell의 경우 xib형태로 따로 빼서 만들었다 그럴경우 어떻게 연결해야하는가?let tbv = storyboard!.instantiateViewController(withIdentifier: "detailViewController")self.show(tbv, sender: nil) Segue http://theeye.pe.kr/archives/2292 let tbv = storyboard!.instantiateViewController(withIdentifier: "detailViewController") as! DetailViewController tbv.idx = mainTableArray[mainTableView.indexPathForSelec.. 2018. 1. 17.
ios App Icon 사이즈 https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/ 앱 아이콘 사이즈Device or contextIcon sizeiPhone180px × 180px (60pt × 60pt @3x)120px × 120px (60pt × 60pt @2x)iPad Pro167px × 167px (83.5pt × 83.5pt @2x)iPad, iPad mini152px × 152px (76pt × 76pt @2x)App Store1024px × 1024px (1024pt × 1024pt @1x) Spotlight, Settings, and Notification IconsDeviceSpotlight icon sizeiPhon.. 2018. 1. 17.
TableVIew에서 이미지사용시 이미지변경이 느릴때 prepareForReuse() prepareForReuse()https://developer.apple.com/documentation/uikit/uitableviewcell/1623223-prepareforreuse 설명이 잘되어있는 사이트https://medium.com/ios-seminar/why-we-use-dequeuereusablecellwithidentifier-ce7fd97cde8e class BestTableViewCell: UITableViewCell { // MARK: - Instance Vars @IBOutlet weak var mainStackView: UIStackView! @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var mainImageView: UI.. 2018. 1. 17.
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection rror Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." HTTPS로 통신을 하지 않을경우 가능하게 풀어줘야한다. https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ http://blowmj.tistory.com/entry/iOS-iOS9-App-Transport-Security-%EC%84%A4%EC%A0%95%EB%B2%95 App-Transport-Security설정 Info.pilist N.. 2018. 1. 11.