Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- TypeORM
- compateto
- 유효시간 설정 url
- 딥다이브
- Dev-Matching
- 타입스크립트
- api 비동기처리
- NestJS
- oauth
- 프로그래머스
- concurrency limit
- bucket4j
- Deep Dive
- 모던 자바스크립트
- 우아한테크코스
- invalid_grant
- 우아한 테크코스
- 자바스크립트
- 음악 url 파일 다운로드
- redis
- 코멘토 #코멘토실무PT #실무PT후기 #실무강의 #리액트강의 #웹프로그래밍 #react #웹개발실무
- 검색
- 스프링부트
- AWS
- 프론트엔드
- this
- 프리코스
- 프론트엔드 과제
- 파일 url
- api 요청 수 제한
Archives
- Today
- Total
개발 알다가도 모르겠네요
다음 뷰 컨트롤러로 navigating하는 두 가지 방법 With 뉴스앱 본문
728x90
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let storyboard = UIStoryboard.init(name : "Main", bundle: nil)
let newsDetail = storyboard.instantiateViewController(identifier: "NewsDetailController") as! NewsDetailController
if let news = newsData {
let row = news[indexPath.row]
if let v = row as? Dictionary<String, Any> {
if let imageUrl = v["urlToImage"] as? String {
newsDetail.imageUrl = imageUrl
}
if let dsec = v["description"] as? String {
newsDetail.dsec = dsec
}
}
}
showDetailViewController(newsDetail, sender: nil)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if "NewsDetail" == segue.identifier {
if let controller = segue.destination as? NewsDetailController {
if let news = newsData {
if let indexPath = tableView.indexPathForSelectedRow { //indexpath 가져오기
let row = news[indexPath.row]
if let v = row as? Dictionary<String, Any> {
if let imageUrl = v["urlToImage"] as? String {
controller.imageUrl = imageUrl
}
if let dsec = v["description"] as? String {
controller.dsec = dsec
}
}
}
}
}
}
}
'모바일 > Swift' 카테고리의 다른 글
Json parsing 을 간단하게 알아보자. With 뉴스앱 (0) | 2021.01.31 |
---|---|
URLSession을 간단하게 알아보자. (0) | 2021.01.30 |
DispatchQueue를 간단하게 알아보자. (0) | 2021.01.30 |
클로저와 옵셔널을 간단하게 알아보자. (0) | 2021.01.30 |
상속을 하는 경우를 간단하게 알아보자. (0) | 2021.01.30 |