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 |
Tags
- AWS
- 스프링부트
- TypeORM
- compateto
- 모던 자바스크립트
- 프리코스
- api 비동기처리
- 딥다이브
- 프론트엔드
- redis
- 프로그래머스
- Deep Dive
- Dev-Matching
- this
- oauth
- 우아한 테크코스
- concurrency limit
- 타입스크립트
- 파일 url
- 프론트엔드 과제
- api 요청 수 제한
- NestJS
- 검색
- invalid_grant
- 우아한테크코스
- bucket4j
- 자바스크립트
- 음악 url 파일 다운로드
- 코멘토 #코멘토실무PT #실무PT후기 #실무강의 #리액트강의 #웹프로그래밍 #react #웹개발실무
- 유효시간 설정 url
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 |