UITableView (Swift)의 프로토 타입 셀에 UIImage가 나타나지 않음

존 하딩 2 세

10 개의 셀을 포함하는 UITableView를 만들었습니다. 각 셀에는 자동 레이아웃을 사용하여 UIImageView가 연결되어 있습니다.여기에 이미지 설명 입력

테이블은 코드에 의해 내 BackTableViewController에 채워집니다.

TableArray = ["Home Page", "Membership Card", "Recent News", "Fitness  Schedule", "Training Log", "Pool Lap Calculator", "Martial Arts Schedule", "Pool Schedule", "Comments", "Acknowledgements"]

문제는 실행 중에 셀을 선택할 때까지 이러한 이미지가 테이블에 나타나지 않는다는 것입니다. 왜이게 .. 누구인가?

감사

편집 : BackTableViewController

UIKit 가져 오기

class BackTableViewController : UITableViewController {

var TableArray = [String]()

var ImageArray = [String]()

override func viewDidLoad() {
    super.viewDidLoad()

    TableArray = ["Home Page", "Membership Card", "Recent News", "Fitness Schedule", "Training Log", "Pool Lap Calculator", "Martial Arts Schedule", "Pool Schedule", "Comments", "Acknowledgements"]

    ImageArray = ["home-50.png","credit_card-50.png","info-50.png","math-50.png","news-50.png","report_card-50.png","weightlift-50.png"]

    // Do any additional setup after loading the view.
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return TableArray.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    var cell = tableView.dequeueReusableCellWithIdentifier(TableArray[indexPath.row], forIndexPath: indexPath) as! UITableViewCell

    cell.textLabel?.text = TableArray[indexPath.row]

    return cell

}
}
카일 고슬란

당신은 필요 하나 개 재사용 식별자 프로토 타입 셀을. 단서는 "프로토 타입"이라는 이름에 있습니다. 모든 세포가 기반을 둔 청사진이라고 생각하십시오.

뷰 컨트롤러 클래스 ( UITableViewDelegate이면 이어야 함 UITableViewContoller)에서이 메서드를 사용하여 행 수를 지정합니다.

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return yourArray.count
}

이것은 테이블의 오른쪽 행에 올바른 정보를 표시하는 방법입니다.

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    //We create a cell from our prototype that we gave an identifier to in our storyborad.
    let cell = tableView.dequeueReusableCellWithIdentifier("ItemCell") as! UITableViewCell

    //Create a single instance of an item from our items array. we use the indexpath.row that was passed into this method as the index for the array.
    let item = yourArray[indexPath.row]

    //You can go into your array and get the right info out regarding this row by using the indexPath.row
    cell.textLabel?.text = item
    cell.imageView?.image = UIImage(named: item)

    //Finally this method returns the correctly configured cell fro the tableview to display.
    return cell
}

도움이 되었기를 바랍니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

UITableView가 프로토 타입 셀을 표시하지 않음

분류에서Dev

UITableView에 나타나지 않는 셀-Swift 3

분류에서Dev

UITableView의 여러 프로토 타입 셀

분류에서Dev

사용자 정의 xib 셀이 UITableView swift에 나타나지 않습니다.

분류에서Dev

UIImage가 데스크탑에 쓰거나 나타나지 않음

분류에서Dev

Eclipse RCP 응용 프로그램의 NatTable 셀에 테두리가 나타나지 않습니다.

분류에서Dev

Bxslider가 탭에 나타나지 않음

분류에서Dev

Genymotion HTC에 소프트 키보드가 나타나지 않음

분류에서Dev

새 JCheckbox가 서로 아래에 나타나지 않음

분류에서Dev

Gnuplot의 히트 맵에 제로 축이 나타나지 않음

분류에서Dev

javascript-프로토 타입 내부에 정의되지 않음

분류에서Dev

Swift가 Cell 식별자로 셀을 대기열에서 빼낼 수 없음-식별자에 대한 펜촉 또는 클래스를 등록하거나 스토리 보드의 프로토 타입 셀을 연결해야합니다.

분류에서Dev

세 개의 scrollPanes 중 하나에 스크롤 막대가 나타나지 않음

분류에서Dev

Access VBA의 입력 상자가 나타나지 않음

분류에서Dev

SWIFT UITableView-프로토 타입 셀의 여러 행이 다른 UITableView로 이어집니다.

분류에서Dev

D3 시계가 프로덕션에 나타나지 않음

분류에서Dev

다음 VC의 셀에서 레이블로 텍스트를 전송할 때 VC를 처음 열 때 텍스트가 나타나지 않습니다.

분류에서Dev

phpmyadmin 4.6.0에서 SQL 입력 상자가 나타나지 않음

분류에서Dev

다중 값 속성에 추가 된 프록시 주소가 별도의 줄에 나타나지 않음

분류에서Dev

다양한 UITableView에서 UITableViewCell 프로토 타입 셀

분류에서Dev

브라우저 탭의 제목 표시 줄에 로고 이미지가 나타나지 않음

분류에서Dev

Xcode 7.3.1에서 콘텐츠를 표시하지 않는 신속한 UITableView 프로토 타입 셀

분류에서Dev

내 프로그램에 Entry ()가 나타나지 않습니다.

분류에서Dev

보기를 처음 시작할 때 키보드가 나타날 때 uitableview가 스크롤되지 않습니다. 나중에 제대로 작동합니다

분류에서Dev

branch.io의 공유 시트 (UIActivityViewController)에 메신저가 나타나지 않음

분류에서Dev

UIView에 포함 된 UItableview의 프로토 타입 셀 내에 사용자 정의 UIimageview 표시

분류에서Dev

UIView에 포함 된 UItableview의 프로토 타입 셀 내에 사용자 정의 UIimageview 표시

분류에서Dev

유닉스 셸 출력의 Postgres가 로그에 나타나지 않습니다.

분류에서Dev

쓰기 작업 후 로그 파일에 데이터가 나타나지 않음

Related 관련 기사

  1. 1

    UITableView가 프로토 타입 셀을 표시하지 않음

  2. 2

    UITableView에 나타나지 않는 셀-Swift 3

  3. 3

    UITableView의 여러 프로토 타입 셀

  4. 4

    사용자 정의 xib 셀이 UITableView swift에 나타나지 않습니다.

  5. 5

    UIImage가 데스크탑에 쓰거나 나타나지 않음

  6. 6

    Eclipse RCP 응용 프로그램의 NatTable 셀에 테두리가 나타나지 않습니다.

  7. 7

    Bxslider가 탭에 나타나지 않음

  8. 8

    Genymotion HTC에 소프트 키보드가 나타나지 않음

  9. 9

    새 JCheckbox가 서로 아래에 나타나지 않음

  10. 10

    Gnuplot의 히트 맵에 제로 축이 나타나지 않음

  11. 11

    javascript-프로토 타입 내부에 정의되지 않음

  12. 12

    Swift가 Cell 식별자로 셀을 대기열에서 빼낼 수 없음-식별자에 대한 펜촉 또는 클래스를 등록하거나 스토리 보드의 프로토 타입 셀을 연결해야합니다.

  13. 13

    세 개의 scrollPanes 중 하나에 스크롤 막대가 나타나지 않음

  14. 14

    Access VBA의 입력 상자가 나타나지 않음

  15. 15

    SWIFT UITableView-프로토 타입 셀의 여러 행이 다른 UITableView로 이어집니다.

  16. 16

    D3 시계가 프로덕션에 나타나지 않음

  17. 17

    다음 VC의 셀에서 레이블로 텍스트를 전송할 때 VC를 처음 열 때 텍스트가 나타나지 않습니다.

  18. 18

    phpmyadmin 4.6.0에서 SQL 입력 상자가 나타나지 않음

  19. 19

    다중 값 속성에 추가 된 프록시 주소가 별도의 줄에 나타나지 않음

  20. 20

    다양한 UITableView에서 UITableViewCell 프로토 타입 셀

  21. 21

    브라우저 탭의 제목 표시 줄에 로고 이미지가 나타나지 않음

  22. 22

    Xcode 7.3.1에서 콘텐츠를 표시하지 않는 신속한 UITableView 프로토 타입 셀

  23. 23

    내 프로그램에 Entry ()가 나타나지 않습니다.

  24. 24

    보기를 처음 시작할 때 키보드가 나타날 때 uitableview가 스크롤되지 않습니다. 나중에 제대로 작동합니다

  25. 25

    branch.io의 공유 시트 (UIActivityViewController)에 메신저가 나타나지 않음

  26. 26

    UIView에 포함 된 UItableview의 프로토 타입 셀 내에 사용자 정의 UIimageview 표시

  27. 27

    UIView에 포함 된 UItableview의 프로토 타입 셀 내에 사용자 정의 UIimageview 표시

  28. 28

    유닉스 셸 출력의 Postgres가 로그에 나타나지 않습니다.

  29. 29

    쓰기 작업 후 로그 파일에 데이터가 나타나지 않음

뜨겁다태그

보관