0

In my app when I am moving from the tableview footer section to another view controller it's moving fine but after moving the app will crash. Afterwards I'm getting this error.

enter image description here

Here is my Code:

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    if(tableView == educateTbl) //here you can make a decision
    {
        float footerWidth = 150.0f;
        float padding = 10.0f;
        UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, footerWidth, 50.0)];
        footerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        UIButton *addEdu = [[UIButton alloc]initWithFrame:CGRectMake(padding, 0, footerWidth - 2.0f * padding, 44.0f)];
        addEdu.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
        addEdu.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;

        addEdu.backgroundColor = [UIColor colorWithRed:23/255.0 green:186/255.0 blue:239/255.0 alpha:1.0];
        [addEdu setTitle:@"Add Education" forState:UIControlStateNormal];
        [addEdu addTarget:self action:@selector(addEducation:) forControlEvents:UIControlEventTouchUpInside];
        [addEdu setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];//set the color this is may be different for iOS 7
        addEdu.frame=CGRectMake(0, 0, 200, 30); //set some large width to ur title
        [footerView addSubview:addEdu];
        return footerView;
    }
    return nil;
}

- (void)addEducation:(id)sender
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    AddEducationViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"AddEducationVC"];
    [self presentViewController:ivc animated:YES completion:nil];
}
User558
  • 1,165
  • 1
  • 13
  • 37

1 Answers1

0

[self presentViewController:ivc animated:YES completion:nil];

try to change for :

[self.view.window.rootViewController presentViewController:deleAlert animated:YES completion:nil];

Jonhory
  • 1
  • 3