转场后 iOS 5 黑屏

iOS 5 Black screen after segue(转场后 iOS 5 黑屏)
本文介绍了转场后 iOS 5 黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个带有情节提要和两个场景的 iOS 5 应用程序.场景 1 是一个选择列表,而场景 2 显示每个选择的详细信息

I have an iOS 5 application with a storyboard and two scenes. Scene 1 is a selection list while Scene 2 shows details for each selection

在场景 1 中,我需要传递一个变量,我这样做:

In Scene 1 I need to pass a variable and I do that with:

//Handles the selection 
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    Guests *myGuests =[guestList objectAtIndex:[indexPath row]];

    selectedGuest = [[NSString alloc] initWithFormat:@"You have selected %@", myGuests.guestID];

    [self performSegueWithIdentifier:@"TGG" sender:self];
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if([[segue identifier] isEqualToString:@"TGG"]){
        GuestDetailsViewController *vc = [segue destinationViewController];
        [vc setGuestSelected:selectedGuest];
    }
}

在场景 2(细节)中,我使用它来验证是否收到了正确的变量

In Scene 2 (details) I use this to verify that the right variable was received like this

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@", guestSelected];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Selection" message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];          

     nameCell.textLabel.text= msg;

    [super viewDidLoad];
}

所有这些都可以正常工作,并且警告框会显示正确的变量,并且会过渡到新场景.但是,警告框总共显示 5 次以上 &结束,一旦完成,整个窗口都是黑色的.那时我的场景(场景 2)中没有显示任何内容.所以我知道我有正确的转场,它会根据需要转换,我只是在屏幕上看不到任何东西.

All of this works fine and the alert box shows the right variable and there is a transition to the new scene. HOWEVER, the alert box displays a total of 5 times over & over and, once completed, the whole window is black. Nothing from my scene (Scene 2) is displayed at that point. So I know I have the right segue, it transitions as desired, I just can't see anything on my screen.

推荐答案

我遇到了非常相似的情况.我无意中取消了该方法的注释:

i ran into a situation very similar. i had unintentionally un-commented the method:

-(void)loadView

相信这个方法覆盖了 IB 接口,而是用这个代码创建了它.检查以确保它被删除或注释掉恕我直言.

i believe this method overrides the IB interface and created it from this code instead. check to make sure it is either removed or commented out IMHO.

这篇关于转场后 iOS 5 黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

AWS DynamoDB Batch Get Request - iOS(AWS DynamoDB 批量获取请求 - iOS)
DynamoDB auto incremented ID amp; server time (iOS SDK)(DynamoDB 自动递增 ID amp;服务器时间(iOS SDK))
dynamodb scanexpression with scan filter in objective-c(在objective-c中带有扫描过滤器的dynamodb scanexpression)
Getting full access to DynamoDB from my ios app using AWS Cognito Developer Identities(使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限)
iOS framework with dependencies(具有依赖项的 iOS 框架)
Can#39;t change target membership visibility in Xcode 4.5(无法更改 Xcode 4.5 中的目标成员身份可见性)