首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >信号SIGABRT xcode

信号SIGABRT xcode
EN

Stack Overflow用户
提问于 2012-06-21 11:58:23
回答 1查看 1.1K关注 0票数 0

我有一个网格,在我的网格中有52个正方形作为一个按钮,当我点击我的方格时,我应该转到另一个页面,但是我的进程终止了,我不知道为什么?

你能帮帮我吗?

提前感谢!

Hear是我的YearView页面(52平方在这里)

代码语言:javascript
运行
复制
- (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"];
    }}

编辑:

*第一次抛出调用堆栈:

代码语言:javascript
运行
复制
 (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

从这里开始调试= Sigabrat信号

代码语言:javascript
运行
复制
WeekView *crtObj=[[WeekView alloc]initWithNibName:@"WeekView" bundle:nil];
EN

回答 1

Stack Overflow用户

发布于 2012-06-21 12:36:04

你用的是故事板,但你用的是

代码语言:javascript
运行
复制
WeekView *crtObj=[[WeekView alloc]initWithNibName:@"WeekView" bundle:nil];
[self.navigationController pushViewController:crtObj animated:YES];

我认为你想在这里使用故事板:

代码语言:javascript
运行
复制
[self performSegueWithIdentifier:@"WeekView" sender:self];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11137643

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档