Creating nib view from UIBarButtonItem?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 06:18:09

问题


So I've seen previous questions similar to this but they were of no help. I've read Apple's documentation too but I could not understand where I've gone wrong. AFAIK I did everything logically, but when I click on my done button on an UIToolbar overlay, the button can be pushed but it does not do anything. This obviously means it fails to acknowledge the written code. But how?

I want to bring up the .nib of "TableViewController" when a done button is clicked on my UIToolbar. But the below isn't allowing the click to bring up a new view. How do I rectify this? Please show me where I went wrong and what should be replaced and why.

//Here's the selector:
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
    UIBarButtonSystemItemDone target:self  action:@selector(doneButtonPressed)];

Here's how I made my action.

-(void)doneButtonPressed {
    TableViewController *tableView = [[TableViewController alloc]
        initWithNibName:@"TableViewController" bundle:nil];
    tableView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:tableView animated:YES];
}

// Yet nothing happens when I click on my done button on my overlay. The button
// can be clicked, but nothing happens. Please shed any insight pleasee!

回答1:


Did you create the UIToolbar into a nib file?



来源:https://stackoverflow.com/questions/11712784/creating-nib-view-from-uibarbuttonitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!