2
스토리 보드를 사용 중입니다 & 개 있습니다. 연락처 목록 (tableView)에서 "프로필보기"(ScrollView)로 전환하고 싶습니다.Storyboard & Segue - 좋은 결과를 얻고 있습니까?
세 가지 질문 :
- 이것이 최선의 방법입니다 (& 아름다운 더 깨끗한)이 작업을 수행하려면? & 왜?
- 내가 이렇게 할 때 : ProfileViewController * aProfileView = (ProfileViewController *) [segue destinationViewController]; 이 새로운 뷰를 인스턴스화합니까? (마치 2 개의 프로파일보기를 생성합니다).
- 내가 청소해야합니까 ("프로필보기"어딘가 삭제 하시겠습니까?) 아니면 네비게이션 컨트롤러로 혼자하고 있습니까?
// 코드이 작업을 수행하는
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showProfileSelected"])
{
// Get the Selected raw
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
Profile *selectedProfile = [self.profilesTable objectAtIndex:indexPath.row];
// Using segue --> Send the current selected profile to "ProfileView"
ProfileViewController *aProfileView = (ProfileViewController *)[segue destinationViewController];
aProfileView.currentProfile = selectedProfile;
}
}
// 다른 방법 :
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showProfileSelected"])
{
// Get the Selected raw
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
Profile *selectedProfile = [self.profilesTable objectAtIndex:indexPath.row];
// Using segue --> Send the current selected profile to "ProfileView"
[segue.destinationViewController setCurrentProfile:selectedProfile];
}
}
답장을 보내 주셔서 감사합니다. 이게 필요한거야? (ProfileViewController *) 또한 그것없이 작동하기 때문에. – Slake
그래도 컴파일러 경고가 표시됩니다. 거기서 뭐하는거야 캐스트, 그리고 그것은 컴파일러가 어떤 클래스 (예 : ProfileViewController, UIViewController 아닌) 알고 보자 – jrturton
아니요, 컴파일러 경고가 점점 아니에요 - 잘 모르겠습니다 캐스트입니다. 다시 한번 감사드립니다. – Slake