-1

when i click back button then controller back to menu but crash the application ?

       -(void)launchselfEvalutionFromPresidentDetailViewController
        {
            Self_Evalution_Page *self_page=[[Self_Evalution_Page alloc]initWithNibName:@"Self_Evalution_Page" bundle:nil];

            [self.navigationController pushViewController:self_page animated:YES];

        }

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
        self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

        self.pageController.dataSource = self;
        [[self.pageController view] setFrame: CGRectMake(0,[topBar bottom] + 5,320,500)];


        SelfEvalutionTableView *selfObj=[self viewControllerAtIndex:0];


        NSArray *viewControllers = [NSArray arrayWithObject:selfObj];

        [self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

        [self addChildViewController:self.pageController];
        [[self view] addSubview:[self.pageController view]];
        [self.pageController didMoveToParentViewController:self];

    }

i used this code for move forward .but i click back button application crash.

  • What's the error message? – Larme May 21 '14 at 06:57
  • when i click back button application hang on left menu . – user3656071 May 21 '14 at 07:02
  • That doesn't give the error message. Look at the debugger, what's the kind of error message? EXC_BAD_ACCESS? Maybe Enable NSZOmbies to get a clearer message? From what I look, seems that your code compiles. But, it would help to give us what line is causing the issue... – Larme May 21 '14 at 07:05
  • i have navigation back button .i created UIpageviewcontroller.when i click back button then controller move back to privious view but controller go to menu and hang on same page .no error massage in log. – user3656071 May 21 '14 at 07:11
  • how to nil the back button – user3656071 May 21 '14 at 07:20
  • What do you mean, how to "nil the backbutton" ? Hide it? If yes, there are plenty question in SO asking how to do it. – Larme May 21 '14 at 07:24
  • Terminating in response to SpringBoard's termination. this error massage in log – user3656071 May 21 '14 at 07:28
  • Here we're talking! http://stackoverflow.com/questions/10281160/terminating-in-response-to-springboards-termination – Larme May 21 '14 at 07:29
  • how to solve "Terminating in response to SpringBoard's termination" memory problem – user3656071 May 21 '14 at 07:36

2 Answers2

0

Try using this in your back button press event or code.

[self dismissViewControllerAnimated:YES completion:nil];

Hope this helps.

Dhrumil
  • 3,221
  • 6
  • 21
  • 34
0

Customise your back button action, Try below code

 UIImage *buttonImage = [UIImage imageNamed:@"backBtn.png"];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:buttonImage forState:UIControlStateNormal];
    button.frame = CGRectMake(0, 0, 25, 25);
    [button addTarget:self action:@selector(GoBack) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.leftBarButtonItem = customBarItem;
    [customBarItem release];

Call this function

-(IBAction)GoBack
{
    [self.navigationController popViewControllerAnimated:YES];
}
Sivaprasad Km
  • 712
  • 4
  • 15