2012-06-21 3 views
0

У меня есть сетка, и внутри моей сетки есть 52 квадрата в виде кнопки, когда я нажимаю на свой квадрат. Мне нужно перейти на другую страницу, но мой процесс завершен. Я не знаю почему?Сигнал SIGABRT xcode

не могли бы вы помочь мне?

Заранее благодарен!

Слышать это моя страница YearView (52 квадрат здесь)

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
// Do any additional setup after loading the view. 
int rows = 13, columns = 4; 
UIView *buttonView = [[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, 80*columns, 32*rows)]; 
int currentTag = 0; 

for (int y = 0; y < rows; y++) { 
    for (int x = 0; x < columns; x++) { 

     UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; 
     // [button.layer setBorderWidth:1.0]; 
     // [button.layer setBorderColor:UIColor blackColor]]; 
     button.backgroundColor=[UIColor colorWithRed: 201.0/255.0 green: 201.0/255.0 blue:201.0/255.0 alpha: 1.0]; 
     button.tag = currentTag; 
     currentTag++; 
     [button.layer setBorderColor: [[UIColor blackColor] CGColor]]; 
     [button.layer setBorderWidth: 1.0]; 
     [button setTitle:[NSString stringWithFormat:@"%d",currentTag] forState:UIControlStateNormal]; 
     button.frame = CGRectMake(80*x, 32*y, 80, 32); 
     [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; 
     [buttonView addSubview: button]; 

    } 
} 

// Center the view which contains your buttons 
CGPoint centerPoint = buttonView.center; 
centerPoint.x = self.view.center.x; 
buttonView.center = centerPoint; 
[self.view addSubview:buttonView];  

} 


-(void)buttonPressed:(UIButton *)button 
{ 
NSLog(@"button %u -- frame: %@", button.tag, NSStringFromCGRect(button.frame)); 
WeekView *crtObj=[[WeekView alloc]initWithNibName:@"WeekView" bundle:nil]; 
[self.navigationController pushViewController:crtObj animated:YES]; 
// [crtObj release]; 


} 

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
if ([segue.identifier isEqualToString: @"WeekView"]){ 

     // Get reference to the destination view controller 
    // WeekView *vc = [segue destinationViewController]; 

     // Pass any objects to the view controller here, like... 
     // [vc setMyObjectHere:object]; 
    [segue.destinationViewController setTitle:@"WeekView"]; 
    }} 

Edit:

* Первый стек бросить вызов:

(0x13e0022 0x1571cd6 0x1388a48 0x13889b9 0x24b638 0xf11fc 0xf1779 0xf199b 0xf1d11 0x1038fd 0x103aef 0x103dbb 
    0x10485f 0x104e06 0x104a24 0x3529 0x13e1e99 0x2d14e 0x2d0e6 0xd3ade 0xd3fa7 0xd3266 0x523c0 0x525e6 0x38dc4 
0x2c634 0x12caef5 0x13b4195 0x1318ff2 0x13178da 0x1316d84 0x1316c9b 0x12c97d8 0x12c988a 0x2a626 0x204d 0x1fb5) 
terminate called throwing an exception(lldb) 


0xbffff5b4 
0xbffff6d4 

с отладкой = Сигнал Сигабрат начинается отсюда

WeekView *crtObj=[[WeekView alloc]initWithNibName:@"WeekView" bundle:nil]; 
+0

Можете ли вы предоставить ошибку, прежде всего (0x738978928) в окне вывода – Oritm

+0

Каков точный журнал, который вы получаете в отчете о сбое? – Dhruv

+0

@Oritm Я положил это выше Спасибо –

ответ

0

Вы используете раскадровку, но вы используете

WeekView *crtObj=[[WeekView alloc]initWithNibName:@"WeekView" bundle:nil]; 
[self.navigationController pushViewController:crtObj animated:YES]; 

я думаю, что вы хотите использовать раскадровку здесь:

[self performSegueWithIdentifier:@"WeekView" sender:self]; 
+0

следует удалить это - >> WeekView * crtObj = [[WeekView alloc] initWithNibName: @ "WeekView" bundle: nil]; [self.navigationController pushViewController: crtObj animated: YES]; и добавьте код stiil error –

+0

да, вы должны удалить это, раскадровка делает это за вас. Я ссылаюсь на http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/SecondiOSAppTutorial/Introduction/Introduction.html – Oritm

+0

Я удаляю его, но у меня такая же ошибка. –

Смежные вопросы