CollectionView
의 셀을 선택하면 새보기가로드됩니다.CollectionViewCell에서 신속하게 새보기를 표시하지 못했습니다.
모든 지역 온라인은 새로운보기 및 스토리 보드의 네비게이션 컨트롤러를 등록하는 것만 큼 간단 말한다 다음 Ctrl 키 + 새보기 내 CollectionViewCell
에서 드래그를 클릭합니다.
코드를 컴파일하고 실행하지만 셀을 클릭해도 새로운 뷰가 표시되지 않습니다. 나는 무엇을 놓쳤는가? 여기 내 CollectionView
컨트롤러 코드 :
스토리 보드는
편집 ...이 (정확한 이름과 모든 식별) 나의 다음 뷰 CollectionView
에서 SEGUE이다, 그래서 조금 혼란 스러워요 말한다 내가 여기에서 뭔가를했을 경우를 대비해서 문제를 일으키고 있습니다. 비슷한 문제를 가진 사람들을위한
IBOutlet weak var calendarCollection: UICollectionView!
var collectionView: UICollectionView?
let calendarCellIdentifier: String = "calendarCell"
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 50, left: 10, bottom: 10, right: 10)
layout.itemSize = CGSize(width: 60, height: 60)
collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
collectionView!.dataSource = self
collectionView!.delegate = self
collectionView!.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: calendarCellIdentifier)
collectionView!.backgroundColor = UIColor.blackColor()
self.view.addSubview(collectionView!)
}
// Return the collectionView cell at IndexPath
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell: UICollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier(calendarCellIdentifier, forIndexPath: indexPath) as UICollectionViewCell
cell.backgroundColor = UIColor.blueColor()
return cell
}
func collectionView(collectionView: UICollectionView, shouldHighlightItemAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return challengeDurationDays
}
셀에서보기가 아닌 셀에서 실제로 세그먼트를 만들 었는지 확인하십시오. 당신은 segue의 원을 클릭하여 확인할 수 있습니다. 셀이 강조 표시되면 segue가 올바른 것입니다. 전체보기가 강조 표시되면 segue가 올바르지 않습니다. – dasdom
셀이 하이라이트되므로, 그렇지 않습니다. 내 코드가 만들어지고 실행됩니다. 셀을 클릭 할 때 아무 것도하지 않습니다. – SwoopsFromAbove
당신의 segue가 push segue라고 가정합니다. 그렇다면 뷰 컨트롤러가 내비게이션 컨트롤러에 내장되어 있습니까? – dasdom