본문 바로가기

ios7

iOS) Alert 예제 (UIAlertController / UIAlertAction) 오늘은 iOS에서 사용하는 alert를 직접 만들어보겠습니다. 예제는 세 가지로 다음과 같습니다. 예제를 시작하기 앞서, 스토리보드에 버튼 하나를 만든 후, 코드에 연결하여 클릭하면 alert 이벤트가 실행되도록 했습니다. Alert(1) 코드 먼저 보면 다음과 같습니다. 구조는 UIAlertController를 통해 구조 및 스타일을 설정합니다. 이때 스타일은 그림 1. 과 같은 .alert 스타일과 그림 2. 와 같은 .actionsheet가 있습니다. 그림 4. 와 같이 title과 message는 다음과 같은 위치에 표시됩니다. 다음으로 UIAlertAction을 통해 action을 만들어줍니다. action은 쉽게 말해서 버튼이라고 생각하면 됩니다. 파라미터로 title과 style, handl.. 2020. 10. 11.
iOS) tableView(_:cellForRowAt:) / tableView(_:numberOfRowsInSection:) Table views는 데이터를 보여주는 것만 관리하고, 데이터 그 자체를 관리하지는 않습니다. 데이터를 관리하기 위해서는 table with a data source object를 제공해야 하는데 UITableViewDataSource 프로토콜을 채택하여 구현할 수 있습니다. 대표적인 메서드로 tableView(_:cellForRowAt:)와 tableView(_:numberOfRowsInSection:)가 있는데, 프로토콜을 채택하면 필수적으로 요구되는 메서드입니다. 사용 예시는 다음과 같습니다. // Return the number of rows for the table. override func tableView(_ tableView: UITableView, numberOfRowsInSection.. 2020. 10. 11.
HIG 번역) iOS - Mac Catalyst Mac Catalyst When you use Mac Catalyst to create a Mac version of your iPad app, you make your app available to a new audience while giving existing users the opportunity to enjoy it in a new environment. 당신이 아이패드 앱의 맥 버전을 만들기 위해 Mac Catalyst를 사용할 때, 기존의 사용자에게 새로운 환경에서 즐길 수 있는 기회를 주면서 새로운 사용자들이 앱을 사용할 수 있도록 해야 합니다. For developer guidance, see Creating a Mac Version of Your iPad App. 아이패드 앱의 맥 버전.. 2020. 9. 21.
HIG 번역) iOS - Interface Essentials Interface Essentials Most iOS apps are built using components from UIKit, a programming framework that defines common interface elements. This framework lets apps achieve a consistent appearance across the system, while at the same time offering a high level of customization. UIKit elements are flexible and familiar. They’re adaptable, enabling you to design a single app that looks great on any .. 2020. 6. 2.