简体   繁体   English

如何从一个视图导航到另一个视图而无需导航? 在iPhone中

[英]how to navigate from one view to another without navigation? in iphone

Tour.m: Tour.m:

-(void)loadViewMonthArr:(NSMutableArray*)arr
{
    if ([arr count]) {
        self.selectedDate=(NSDate*)[arr objectAtIndex:0];
   //     [slider setselectedbuttonfordate:self.selectedDate];
        NSDateFormatter *form=[[NSDateFormatter alloc] init];
        [form setDateFormat:@"MMMM dd"];

        [(UILabel*)[self.view viewWithTag:7600]setText:[form stringFromDate:self.selectedDate]];
        [form setDateFormat:@"yyyy"];
        [(UILabel*)[self.view viewWithTag:7601]setText:[form stringFromDate:self.selectedDate]];
        NSMutableArray *arr=[[NSMutableArray alloc] init];
        [form setDateFormat:@"yyyy-MM-dd"];


        form=nil;
      arr=nil;
    }


    [UIView beginAnimations:@"Pie" context:nil];
    [UIView setAnimationDuration:.5];
    [UIView setAnimationTransition:UIViewAnimationOptionTransitionFlipFromLeft forView:self.view cache:NO];

    monthlyCalendar.hidden = YES;
    New_Retailer.view.hidden = NO;
    [New_Retailer LoadNewRetailer];
    [self.view bringSubviewToFront:New_Retailer.view];

    [UIView commitAnimations];

in tour class I got calendar with dates. 在旅游课程中,我得到了带有日期的日历。 when i tap the particular date how can navigate tour to newretailer_tour class withoutusing navigation controler?. 当我点击特定日期时,如何在不使用导航控件的情况下导航到newretailer_tour类?

i am going LoadNewRetailer method. 我要使用LoadNewRetailer方法。 method is working. 方法正在工作。 but newretailer_tour.xib i setted blue background color. 但是newretailer_tour.xib我设置了蓝色背景色。 when i run app, when i tap the date,it is going to newretailer_tour class method. 当我运行应用程序时,当我点击日期时,它将转到newretailer_tour类方法。 but, in simulator i am not getting color newretailer_tour class. 但是,在模拟器中,我没有获得颜色newretailer_tour类。 suuggest me 给我建议

SecondViewController *navigate=[[SecondViewController  alloc]initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
[self presentViewController:navigate animated:YES completion:^(void){}];

只需使用当前的modalview控制器。它将显示视图控制器。然后在视图中添加一个工具栏,然后添加一个后退按钮。单击后退按钮只需关闭模式视图控制器。我想这会为您做到这一点。

You could always use, 您可以随时使用,

presentViewController presentViewController

or you would manually add the viewcontrollers view to your existing view. 或者您可以将viewcontrollers视图手动添加到现有视图。

YourVC *vcObject=[[YourVC alloc]initWithNibName:@"YourVC" bundle:nil]; YourVC * vcObject = [[[YourVC alloc] initWithNibName:@“ YourVC” bu​​ndle:nil];

[existingVC addSubview:vcObject.view]; [existingVC addSubview:vcObject.view];

You could also add some animation while adding it as a subview. 您还可以在将其添加为子视图时添加一些动画。

[UIView beginAnimations:@"Pie" context:nil];
[UIView setAnimationDuration:.5];
[UIView setAnimationTransition:UIViewAnimationOptionTransitionFlipFromLeft forView:vcObject.view] cache:NO];
[existingVC addSubview:vcObject.view];
[UIView commitAnimations];

For giving only effect of navigation controller you can use modalTransitionStyle 为了只给出导航控制器的效果,可以使用modalTransitionStyle

For Example, 例如,

   [self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]
[self presentModalViewController:<#(UIViewController *)#> animated:<#(BOOL)#>];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM