如何在splitview应用程序中给出curlup效果

时间:2012-04-12 04:24:34

标签: iphone objective-c

在我的Mac中我有3.2.5 xcode   我创建spliteview应用程序我有卷曲效果的问题   当我点击单元格的左侧视图时,右侧的详细视图必须打开并卷起 我想只给出curlup only detailview而不是所有splitiew我想要文化代码应用程序名称是想想

这是我尝试的代码,但它在整个splitview上工作我想在从左侧视图中选择单元格时只运行curlup detailview

#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.
   // NSUInteger row = indexPath.row;

    UIViewController <SubstitutableDetailViewController> *detailViewController = nil;

    if ([indexPath row] == 0 && [indexPath section] == 0) {
        TodoDetailViewController *newDetailViewController = [[TodoDetailViewController alloc] initWithNibName:@"TodoDetailViewController" bundle:nil];
        detailViewController = newDetailViewController;
    }

    if ([indexPath row] == 0 && [indexPath section] == 1){
        PeopleViewController *newDetailViewController = [[PeopleViewController alloc] initWithNibName:@"PeopleViewController" bundle:nil];
        detailViewController = newDetailViewController;
    }

    if ([indexPath row] == 1 && [indexPath section] == 1){
        DocumentsViewController *newDetailViewController = [[DocumentsViewController alloc] initWithNibName:@"DocumentsViewController" bundle:nil];
        detailViewController = newDetailViewController;
    }

    if ([indexPath row] == 2 && [indexPath section] == 1){
        PlannerViewController *newDetailViewController = [[PlannerViewController alloc] initWithNibName:@"PlannerViewController" bundle:nil];
        detailViewController = newDetailViewController;
    }

    //if ([indexPath row] == 0 && [indexPath section] == 2){
//        PlannerRequestsViewController *newDetailViewController = [[PlannerRequestsViewController alloc] initWithNibName:@"PlannerRequestsViewController" bundle:nil];
//        detailViewController = newDetailViewController;
//    }

    if ([indexPath row] == 0 && [indexPath section] == 2){
        ArchivedPeopleViewController *newDetailViewController = [[ArchivedPeopleViewController alloc] initWithNibName:@"ArchivedPeopleViewController" bundle:nil];
        detailViewController = newDetailViewController;
    }


    // Update the split view controller's view controllers array.
   //NSArray *viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil];
   // splitViewController.viewControllers = viewControllers;

    //new try-----today
    //splitViewController.viewControllers = [NSArray
                                     //  arrayWithObjects:masterView, detailsView, nil];
    splitViewController.viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:splitViewController.view cache:YES];
    [UIView commitAnimations];

1 个答案:

答案 0 :(得分:1)

尝试替换

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:splitViewController.view cache:YES];

通过

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:detailViewController.view cache:YES];

*更新 *

在TodoDetailsViewContrroller.h

- (void)viewWillAppear:(BOOL)animated 
{
    [super viewWillAppear:animated];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [UIView commitAnimations];
}