转场后 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 黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to stop UIBarButtonItem text from truncating?(如何阻止UIBarButtonItem文本被截断?)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
NSURLSessionTaskPriority seems to be ignored?(NSURLSessionTaskPriority似乎被忽略了?)
How to make dataWithEPSInsideRect vector rather than bitmap in vector format?(如何用EPSInside Rect将dataWithEPSInside Rect变成矢量而不是位图的矢量格式?)
HTTPS request using volley(使用 volley 的 HTTPS 请求)