ViewControllers之间的转换不起作用

时间:2014-02-01 08:32:16

标签: ios iphone objective-c uistoryboardsegue

我在viewcontroller中有一个按钮,我与另一个ViewController链接。

关于第一个viewController的实现,我创建了这个方法:

- (IBAction)SignUpPressed:(id)sender {
    [self performSegueWithIdentifier:@"signup" sender:self];
}

但是当我在模拟器上测试时,我按下按钮,应用程序崩溃

argc    int 1   1
argv    char ** 0x7fff5fbfece8  0x00007fff5fbfece8


libc++abi.dylib: terminating with uncaught exception of type NSException

返回此错误。 我该怎么做才能解决这个问题?

附录:

错误代码(所有代码都在错误点之上)

    #import "LoginViewController.h"
    #import "ADVTheme.h"

    @interface LoginViewController ()

    @end

    @implementation LoginViewController



    - (void)viewDidLoad
    {
        [super viewDidLoad];

        id <ADVTheme> theme = [ADVThemeManager sharedTheme];

        [self.view setBackgroundColor:[UIColor colorWithPatternImage:[theme viewBackground]]];



        [self.loginButton setBackgroundImage:[theme colorButtonBackgroundForState:normal] forState:UIControlStateNormal] ;

         [self.loginButton setBackgroundImage:[theme colorButtonBackgroundForState:UIControlStateHighlighted] forState: UIControlStateHighlighted];
    }

    - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        self.title = @"Login";
    }

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

    #pragma mark - Table view data source

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {

        // Return the number of sections.
        return 0;
    }

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {

        // Return the number of rows in the section.
        return 0;
    }

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

        // Configure the cell...

        return cell;
    }

All exception Traceback


014-02-01 11:55:05.904 theBeeGame[15793:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<LoginViewController: 0x10982c3b0>) has no segue with identifier 'signup''
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000101f90795 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000101cf3991 objc_exception_throw + 43
    2   UIKit                               0x0000000100a43e05 -[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0
    3   theBeeGame                          0x0000000100005cf1 -[LoginViewController SignUpPressed:] + 97
    4   UIKit                               0x0000000100957096 -[UIApplication sendAction:to:from:forEvent:] + 80
    5   UIKit                               0x0000000100957044 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 17
    6   UIKit                               0x0000000100a2b450 -[UIControl _sendActionsForEvents:withEvent:] + 203
    7   UIKit                               0x0000000100a2a9c0 -[UIControl touchesEnded:withEvent:] + 530
    8   UIKit                               0x000000010098bc15 -[UIWindow _sendTouchesForEvent:] + 701
    9   UIKit                               0x000000010098c633 -[UIWindow sendEvent:] + 988
    10  UIKit                               0x0000000100965fa2 -[UIApplication sendEvent:] + 211
    11  UIKit                               0x0000000100953d7f _UIApplicationHandleEventQueue + 9549
    12  CoreFoundation                      0x0000000101f1fec1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    13  CoreFoundation                      0x0000000101f1f792 __CFRunLoopDoSources0 + 242
    14  CoreFoundation                      0x0000000101f3b61f __CFRunLoopRun + 767
    15  CoreFoundation                      0x0000000101f3af33 CFRunLoopRunSpecific + 467
    16  GraphicsServices                    0x000000010293c3a0 GSEventRunModal + 161
    17  UIKit                               0x0000000100956043 UIApplicationMain + 1010
    18  theBeeGame                          0x0000000100002ed3 main + 115
    19  libdyld.dylib                       0x00000001033295fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

2 个答案:

答案 0 :(得分:1)

iOS上的约定是让方法从lowerCase和camelCase开始。确保您的控件连接到正确的IBaction(区分大小写!)。还要确保您的segue标识符完全匹配(区分大小写)。

最后,显示完整异常,堆栈跟踪以及发生异常的位置周围的代码(为此,设置异常断点)。

答案 1 :(得分:1)

请在stoarybord控制器上设置您的segue标识符“注册”。