0
我檢查在Xcode中頭部分和頁腳部分,我一個文本框添加到標題中UIcollectionviewcontroller但應用程序運行時,它不顯示文本框?爲什麼?如何顯示UICollectionView控制器中的文本框?
我檢查在Xcode中頭部分和頁腳部分,我一個文本框添加到標題中UIcollectionviewcontroller但應用程序運行時,它不顯示文本框?爲什麼?如何顯示UICollectionView控制器中的文本框?
你應該繼承UICollectionReusableView,將你的插座添加到子類中,修改故事板中標題視圖的重用標識符,並從數據源實現collectionView:viewForSupplementaryViewOfKind:atIndexPath。檢查蘋果文檔。
例如:
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
HeaderView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView" forIndexPath:indexPath];
//set the delegate of the textfield to the view controller
headerView.textField.delegate = self;
return headerView;
}
你可以給我的代碼或例子嗎? – Naveen 2013-04-08 13:06:01
類似的東西 – ragnarok 2013-04-08 13:14:17
:你有樣品代碼嗎? – Naveen 2013-04-08 13:24:20