2009-10-23 4 views
0

이것은 내 last question과 관련 있습니다.iPhone의 탐색 막대 아래에서 슬라이드하는보기를 어떻게 애니메이트 할 수 있습니까?

Xcode의 "탐색 기반 응용 프로그램"템플릿에서 만든 응용 프로그램이 있습니다. (나는 RootViewController라는 UITableViewController 하위 클래스가있는 UINavigationController가 있습니다.)

이 테이블에는 사용자가 상호 작용할 수있는 문자열 목록이 표시됩니다. 탐색 모음에는 왼쪽에 표준 편집/완료 버튼이 있고 오른쪽에 더하기 기호 버튼이 있습니다. 사용자가 더하기 단추를 터치하면 탐색 모음 아래에서 .xib 파일에서로드 된보기를 슬라이드하고 싶습니다.

난 다음을 수행하여이를 구현하려 (. 뷰의 높이가 44 픽셀이다)

NSArray *xibContents = [[NSBundle mainBundle] loadNibNamed:@"NewNameView" owner:self options:nil]; 
UIView *view = [xibContents objectAtIndex:0]; 
[self.view addSubview:view]; 
view.frame = CGRectMake(view.frame.origin.x, view.frame.origin.y - 44, view.frame.size.width, view.frame.size.height); 
[UIView beginAnimations:@"openAdd" context:nil]; 
view.frame = CGRectMake(view.frame.origin.x, view.frame.origin.y + 44, view.frame.size.width, view.frame.size.height); 
[UIView commitAnimations]; 

이 아래로 슬라이드 뷰를 애니메이션하지만 제 표 셀을 커버한다. 나는 테이블 뷰가 아래로 미끄러지도록하고 싶습니다.

답변

2

직접 사용하는 가장 좋은 방법은 UITableView입니다.

//Update your data model with the new row 

[self.tableView beginUpdates]; 

NSArray* indexPaths = [[NSArray alloc] initWithObjects:[NSIndexPath indexPathForRow:0 inSection:0], nil]; 
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop]; 
[indexPaths release]; 

[self.tableView endUpdates]; 

네비게이션 바 아래에 새로운 행이 표시됩니다.

배치 insert/deleting of row and sections에 대한 자세한 내용.

관련 문제