내 앱 (Facebook 메뉴 스타일)에 JASidePanels를 사용하고 있습니다.다른 ViewController에서 UITableViewController 행을 선택하는 방법?
LeftPanel은 내 메뉴 (tableView)이고 내 콘텐츠를 표시하는 CenterPanel에는 collectionView가 있습니다.
센터 collectionView에서 항목을 두드렸을 때 메뉴 인 LeftPanel의 탭된 항목과 동일한 indexPath를 선택하고 싶습니다.
이 작업을 시도했지만 작동하지 않았습니다.
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
// Other codes ...
LeftMenuViewController *leftMC = [[LeftMenuViewController alloc] init];
[leftMC.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:0];
}
어떻게해야합니까?
도움 주셔서 감사합니다.
답변을 통해, 나는 실제로는 이해가 가지 않는 CenterPanel에서 각 선택 이벤트에 대해 새로운 LeftMenuViewController를 작성하고 있음을 이해합니다. 죄송하지만 iOS 개발에 익숙하지 않으므로 코드를 이해하지 못합니다. 좀 더 설명해 주시겠습니까? 어디서 코드를 작성해야할지 모르겠다. 감사! –
틀린! 나는 각 선택 이벤트에서 하나를 만드는 것이 실현 가능하지 않다고 말했다. 그것이 당신이하는 일입니다. - 프로토콜은 iOS의 기본 디자인 패턴입니다. [Cocoa Core Competencies : Protocol] (https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/Protocol.html)을 확인하십시오. – Mundi