Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ARC的EXC_坏通道_Ios_Automatic Ref Counting_Exc Bad Access - Fatal编程技术网

Ios ARC的EXC_坏通道

Ios ARC的EXC_坏通道,ios,automatic-ref-counting,exc-bad-access,Ios,Automatic Ref Counting,Exc Bad Access,此代码在我的项目中启用的控制器的loadView功能中;但是,当我触摸这两个按钮中的任何一个时,“EXC_BAD_ACCESS”总是会崩溃。我已经使用zombie进行调试,但对于这个问题没有任何用处。视图是否加载在tabbarcontroller或navigationcontroller中?视图只是在UIViewController中;但是我使用UIViewController作为initWithRootViewController的参数。谢谢你Lefteris!你是我的救命恩人!不客气。最近A

此代码在我的项目中启用的控制器的loadView功能中;但是,当我触摸这两个按钮中的任何一个时,“EXC_BAD_ACCESS”总是会崩溃。我已经使用zombie进行调试,但对于这个问题没有任何用处。

视图是否加载在tabbarcontroller或navigationcontroller中?视图只是在UIViewController中;但是我使用UIViewController作为initWithRootViewController的参数。谢谢你Lefteris!你是我的救命恩人!不客气。最近ARC也有类似的问题:-)嗯,现在我在看我给你指出的线程,它似乎是ARC前代码。所以解决方案对你来说会有点不同。同样的问题,ARC发布了控制器get,但解决方案如下:
//tool bar
__strong UIToolbar *tBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0,
                                                              self.view.frameHeight-49.0f-44.0f,
                                                              [UIScreen mainScreen].bounds.size.width, 49.0f)];
UITextField* cText = [[UITextField alloc] initWithFrame:CGRectMake(8, 12, 150, 28)];
self.codeText  = cText;
_codeText.backgroundColor = [UIColor whiteColor];
_codeText.placeholder = @"Input code";
[tBar addSubview:_codeText];

UIButton *obtn = [[UIButton alloc] initWithFrame:CGRectMake(180, 12, 60, 28)];
self.okBtn = obtn;
[self.okBtn setTitle:@"OK" forState:UIControlStateNormal];
self.okBtn.titleLabel.textColor = [UIColor whiteColor];
self.okBtn.backgroundColor = [UIColor blueColor];
[self.okBtn addTarget:self action:@selector(confirm) forControlEvents:UIControlEventTouchUpInside];
[tBar addSubview:self.okBtn];

self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(250, 12, 60, 28)];
[_cancelBtn setTitle:@"Cancel" forState:UIControlStateNormal];
_cancelBtn.titleLabel.textColor = [UIColor whiteColor];
_cancelBtn.backgroundColor = [UIColor blueColor];
[_cancelBtn addTarget:self action:@selector(cancel) forControlEvents:UIControlEventTouchUpInside];
[tBar addSubview:_cancelBtn];

[self.view addSubview:tBar];