[英]Things don't work after performing Segue
I have the following problem: I have a ViewController with an UIScrollView and an UICollectionView in it. 我有以下问题:我有一个带有UIScrollView和UICollectionView的ViewController。 When I launch the App directly at this View Controller, everything works fine.
当我直接在此View Controller上启动应用程序时,一切正常。 When I call the ViewController, from another ViewController (here it is a Google Maps SDK Map), the ViewController loads, but when I try to scroll I get this Message, and the App stops:
当我从另一个ViewController(这里是Google Maps SDK地图)调用ViewController时,将加载ViewController,但是当我尝试滚动时会收到此消息,并且应用程序停止:
*** -[TheSecondViewController respondsToSelector:]: message sent to deallocated instance 0x16ef3890
Here is some more code: Calling the view: 这是更多代码:调用视图:
-(void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker {
[self performSegueWithIdentifier:@"OpenSecondView" sender:self];
}
viewDidLoad in the secondView: 第二视图中的viewDidLoad:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
if (IS_IPHONE5) {
self.scrollV.frame = CGRectMake(0, 0, 320, 568);
NSLog(@"Das Geraet ist ein iPhone 5 / iPhone 5S");
} else {
self.scrollV.frame = CGRectMake(0, 0, 320, 480);
NSLog(@"Das Geraet ist ein iPhone 4 / iPhone 4S");
}
[self.view bringSubviewToFront:scrollV];
[scrollV setScrollEnabled:YES];
[scrollV setDelegate:self];
[scrollV setContentSize:CGSizeMake(320, 833)];
[collectionV setScrollEnabled:NO];
activityInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
[activityInd startAnimating];
[imageView setUserInteractionEnabled:YES];
}
Knowing that you have just loaded the secondViewController, it looks like your secondViewController is not allocated properly(rather than being deallocated). 知道您刚刚加载了secondViewController,就好像您的secondViewController没有正确分配(而不是被释放)。 Try using segues that are created in storyboard and calling those segues with code, and/or using strong instead of weak references to your view
尝试使用在情节提要中创建的segue,并使用代码调用这些segue,和/或对视图使用强引用而非弱引用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.