0

サイドメニューにSASlideMenuを実装しましたが、1 つを除いてすべてが優れています。オブジェクトの送信方法がわかりません。

ここでは、ビューの切り替えが行われています。

-(void) switchToContentViewController:(UIViewController*) content{

    CGRect bounds = self.view.bounds;
    if (selectedContent) {


        //Animate out the currently selected UIViewController
        [UIView animateWithDuration:kSlideOutInterval delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
            selectedContent.view.frame = CGRectMake(bounds.size.width,0,bounds.size.width,bounds.size.height);
        } completion:
         ^(BOOL completed) {

             [selectedContent willMoveToParentViewController:nil];
             [selectedContent.view removeFromSuperview];
             [selectedContent removeFromParentViewController];

             content.view.frame = CGRectMake(bounds.size.width,0,0,bounds.size.height);
             [self addChildViewController:content];
             [self.view addSubview:content.view];
             [UIView animateWithDuration:kSlideInInterval delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
                 content.view.frame = CGRectMake(0,0,bounds.size.width,bounds.size.height);

             } completion:^(BOOL completed){
                 selectedContent = content;
                 [content didMoveToParentViewController:self];
                 [self.shield removeFromSuperview];
             }];
         }];
    }else{
        [self addChildViewController:content];
        [self.view addSubview:content.view];
        content.view.frame = CGRectMake(0,0,bounds.size.width,bounds.size.height);
        selectedContent = content;
        [self.shield removeFromSuperview];
        [content didMoveToParentViewController:self];
    }
}

そして、私が望むのは、ここで識別子(NSString)を取得し(解決方法がわかります)、この新しいView Controllerに送信して開くことです。

どうやってやるの?

4

1 に答える 1

1

「コンテンツ」View Controller のストック UIViewController クラスの代わりに、UIViewController のサブクラスを使用できます。このサブクラスでは、

@property (strong, nonatomic) NSString *stringForContentView;

次に、「コンテンツ」View Controllerを現在のView Controllerの子として追加する行のすぐ上に、

content.stringForContentView = @"A string that you already have";
于 2012-10-25T22:02:15.950 に答える