English 中文(简体)
我如何在点击导航电文中嵌入的烟雾后看到最新的次意见?
原标题:How can I see lastest subView after clicking popover embedded in NavigationView?

When click button, a popoverView embedded in NavigationView appear. My code is as follows:

  -(IBAction)myStuffPOP:(id)sender
   {
    if(myStuffListViewController ==nil)
    {        
        myStuffListViewController = [[MyStuffListViewController alloc] init]; 
    }
    UINavigationController *navcontroller=[[[UINavigationController alloc] initWithRootViewController:myStuffListViewController] autorelease];
 // Here we create popover controller.
    mystuffPopoverView =  [[UIPopoverController alloc] initWithContentViewController:navcontroller] ;
    CGRect popoverRect = [self.view convertRect:[sender frame] fromView:[sender superview]];

    popoverRect.size.width = MIN(popoverRect.size.width, 100);
    popoverRect.size.height = 40;

    [mystuffPopoverView presentPopoverFromRect:popoverRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

    [navcontroller setNavigationBarHidden:NO];

} 

导航 Popover的看法 观点:

1st subView ---> 2nd SubView ---> 3rd Subview

如果我触及3rdView Sub,Popover 观点消失了。

My Question is :

当我再次点击纽子时,我就看到最后的观点――3rd SubView notst SubView.

最佳回答
  1. Declare UINavigationController *navcontroller; in .h file
  2. Create only onсe navcontroller with your root view controller, in viewDidLoad method, for example.

    - (void)viewDidLoad {     
        myStuffListViewController = [[MyStuffListViewController alloc] init]; 
        navcontroller=[[UINavigationController alloc] initWithRootViewController:myStuffListViewController]; }
    
  3. Show UIPopoverController with exist navigation stack

    -(IBAction)myStuffPOP:(id)sender    {
        //Here we create popover controller.
        mystuffPopoverView =  [[UIPopoverController alloc] initWithContentViewController:navcontroller] ;
        CGRect popoverRect = [self.view convertRect:[sender frame] fromView:[sender superview]];
    
        popoverRect.size.width = MIN(popoverRect.size.width, 100);
        popoverRect.size.height = 40;
    
        [mystuffPopoverView presentPopoverFromRect:popoverRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp
    animated:YES];
        [navcontroller setNavigationBarHidden:NO]; }
    
  4. Don tabes to release 物体

    - (void)dealloc {   
        [myStuffListViewController release];
        [navcontroller release];
    }
    
问题回答

无需每次创建<条码>。 删除与<代码>相同的方式。 MyStuffListViewController

if ( myNavigationController == nil )
    myNavigationController = [[[UINavigationController alloc]     initWithRootViewController:myStuffListViewController] autorelease];




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签