次のような例外があります。
Thread 1: EXC_Breakpoint (code = EXC_I386_BPT,subcode=0x0)
私のストーリー ボードには、3 つのコントローラーがあります。ナビゲーションコントローラー、UIViewController、そしてテーブルビューコントローラー。アプリの初回起動時に UIViewController が表示されます。Core Data DB にいくつかのものを追加します。次に、このコントローラー自体に「レコードの確認」バーボタンがあります。それをクリックして、3 番目のコントローラーである tableviewcontroller に移動します。ここで、その日に追加した記録を見ることができます。追加したばかりのものをクリックし、次のように NSNotifications を使用して UIviewcontroller 画面に戻ります。
//This code is in tableviewcontroller.didSelectRowAtIndexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
ITMAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.salesOrderObject = [self.salesOrdersArray objectAtIndex:indexPath.row];
NSNotification *notification =[NSNotification notificationWithName:@"reloadRequest"
object:self];
[[NSNotificationCenter defaultCenter] postNotification : notification];
[self.navigationController popViewControllerAnimated:YES];
}
私の ViewController viewDidLoad では、通知をリッスンするためにこのコードを書きます。
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(newReloadData)
name:@"reloadRequest"
object:nil];
-(void)newReloadData
{
self.salesOrder = self.appDelegate.salesOrderObject; //self.reloadedSOObject; //appDelegate.salesOrderObject;
if(self.salesOrder !=nil)
{
//I add UItextviews,textfields,buttons etc here to a scrollview.
ITMCustomView *cView = [[ITMCustomView alloc] initWithFrame:CGRectMake(187, 660, 400, 400)
andOrderedItem:@"New"
andTag:self.tagNumber
withFoldArray:self.foldTypeArray
withRollArray:self.rollTypeArray];
cView.tag =self.tagNumber;
NSLog(@"Assigned tag is %d",cView.tag);
cView.delegate = self;
//[self.scrollView addSubview:customView];
//self.scrollView.contentSize = CGRectMake(187, 660, 400, 400).size;
CGPoint scrollPoint = CGPointMake(0.0, (cView.frame.origin.y/500)*400);
[self.scrollView setContentOffset:scrollPoint animated:YES];
[self.scrollView addSubview:cView];
CGFloat scrollViewHeight = 0.0f;
for (UIView *view in self.scrollView.subviews)
{
scrollViewHeight += view.frame.size.height;
}
CGSize newSize = CGSizeMake(320,scrollViewHeight);
//CGRect newFrame = (CGRect){CGPointZero,newSize};
[self.scrollView setContentSize:newSize];
NSLog(@"750 the tag number is %d",self.tagNumber);
NSLog(@"the scroll view height is %f",scrollViewHeight);
self.currentCGRectLocation = cView.frame;
}
}
スクロール ビューに何かを追加するときに例外が発生するかどうかを考えています。または、スタック オーバーフローをさらに調べたときに、デリゲートまたは NSnotification が原因である可能性があります。例外が発生する理由と場所がわかりません。このコード行を書くと、この例外が発生しますか?
[self.navigationController popViewControllerAnimated:YES];
この質問はこの質問の拡張です UIScrollview に Customview を追加すると、スクロール時に画面がスタックする
この例外がどこでどのように発生するのかわかりません。さらに情報が必要な場合は、お問い合わせください。ありがとう...