English 中文(简体)
驳回ModalView 自行但并非上级的工程
原标题:dismissModalViewControllerAnimated works on self but not parentViewController
  • 时间:2012-01-12 06:28:16
  •  标签:
  • ios5

我 go弃ModalViewController 召集人,在以下机构进行适当工作,但混淆不清为什么在自行(模式词典)上工作,而不是在括号上工作。

在座各位:

  1. I have a UITableViewController with a nav button that calls up a modal view:


    - (void)viewDidLoad
    {
        [super viewDidLoad];
        self.title = @"Root";

        _data = [NSArray arrayWithObjects:@"One", @"Two", nil];
        _detailController = [[DetailViewController alloc] init];

        // Uncomment the following line to preserve selection between presentations.
        // self.clearsSelectionOnViewWillAppear = NO;

        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem;

        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(showAbout)];
    }

    - (void)showAbout
    {
        AboutViewController *abv = [[AboutViewController alloc] init];
        abv.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:abv animated:YES];
    }

此处用一个工具棒 but子对GonViewController 进行排外行动以关闭模式:



    - (IBAction)dismissAction:(id)sender {
        [self dismissModalViewControllerAnimated:YES];
    }

我的问题是,为什么不[本人]放弃ModalViewController Animated]工作。 ? 这是在座吗? 我只想到父母的意见主计长能够放弃儿童模式观点?

感谢!

最佳回答

工作时间相当长。 如果你问我,则最保守的秘密之一。

However self.parentViewController not working is in fact new to iOS 5. It has been replaced with self.presentingViewController.

这引起了一个令人感兴趣的问题,即试图在5号行动之前做到一致。 由于您已经找到了<代码>,因此,L.R.K.R.R.K.R.R.R.R.R.R.R.R.R.I.R.R.R.R.R.R.R.R.I.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.I.R.R.R.R.R.R.R.R.I.R.R.R.R.R.R.R.R.R.I.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R.R 5.

It leaves us doing something like this:

if ([self respondsToSelector:@selector(presentingViewController)]){
    [self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else {
    [self.parentViewController dismissModalViewControllerAnimated:YES];
}
问题回答

我建议不要使用NJones所说的话,而是坚持坚持下去。

[self dismissModalViewControllerAnimated:YES]

该文件本身说明了所有顾问工作的原因:

“提出观点的控制者负责开除其提出的观点控制人。 然而,如果你把这一方法用在所表述的观点控制器上,则自动将这一信息传递给提出看法的控制器。

NOTE:A note on this means in Ri5.0beit. <代码>dismiss ModalViewController Animated:该方法已经折旧。 。 此处应使用





相关问题
New Notification Center

Is there a way to show a notification in the notification center without having push notifications enabled? For example if an email fails to send is there a way i can create a string and display it in ...

submit an ios app using ios5 OS and ios5 sdk

I m wondering if I can install IOS 5 and the IOS 5 SDK and still be able to develop and submit apps to Apple? Or once I install IOS 5 I m forced to install the IOS5 SDK (from what I understand I can t ...

What s new for web developers in iOS 5 Safari?

From the Apple WWDC we have learned that iOS Safari 5 has tabs, and the new Reader and Reading List functionality. None of which is particularly informative for web developers. What are the new ...

iOS - AudioSession Cateogry for AudioUnit Application

I am working on streaming audio player application for iOS. currently i am experimenting with AudioQueue and AudioUnit for playback. Both works fine in the normal condition. But I am facing an issue ...

Couldn t register with the bootstrap Server

I just changed some code in my program and got this error: Couldn t register com.yourcompany.XXX with the bootstrap server. Error: unknown error code. This generally means that another ...

Unable to manage orientation with multiple view controllers

I m trying to build an iPhone application that has two subviews in the main window. Each view has its own UIViewController subclass associated with it. Also, within each controller s implementation, I ...