0

我正在尝试制作,当按下按钮时,它将转到下一页这里是代码,但没有发生任何事情。我放了断点以查看它是否到达那里并且确实到达了那里。在某些时候它正在工作,然后神奇地发生了一些事情,现在它不再工作了。任何帮助都感激不尽。

    //
//  MainViewController.m
//  SimpleApp
//
//  Created by Ruslan on 1/28/13.
//  Copyright (c) 2013 Company. All rights reserved.
//

#import "MainViewController.h"
#import "AppDelegate.h"
#import "EditViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController



// Call this when take photo button is pressed





- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    // Show Camera




}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.


}


// Call this when ipmport button is pressed

-(IBAction)importButton:(id)sender
{
    EditViewController *editPage = [[EditViewController alloc] initWithNibName:@"EditViewController" bundle:nil];
    [self.navigationController pushViewController:editPage animated:(YES)];
//    EditViewController *editPage = [[EditViewController alloc] initWithNibName:@"EditViewController" bundle:nil];
//    [self.navigationController pushViewController:editPage animated:(YES)];

}



@end
4

1 回答 1

0

快速解决:

[self presentViewController:editPage animated:YES completion:nil];

或者,您需要考虑如何将您的观点结合在一起。编辑页面是否应该使用按钮从视图中“推送”(所以它会得到一个“返回”箭头)?如果是,那么持有按钮的视图需要位于导航控制器内,这意味着呈现视图的人会将其包装为导航等...

于 2013-01-30T03:25:06.197 回答