我的iPhone应用程序有一个有趣的小问题.我有一个带有桌子的视图,每个单元格在单击时播放全屏视频,然后当您按完时,视频停止并返回到表格视图.唯一的问题是,当您在视频加载的前2或3秒内完成按下时,当视图返回到表格视图时,屏幕顶部的条形图将告知时间和电池强度等不再那里,它只是一个白色的空间.但是如果你在前几秒后按完了,那么当你回到表视图时,一切都绝对没问题!我完全不知道为什么会这样,我在互联网上找到的唯一一件事就是这个人和我的问题几乎完全相同:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/53020-disappearing-status-bar.html
这导致我尝试使用:
[UIApplication sharedApplication].statusBarHidden = NO;
Run Code Online (Sandbox Code Playgroud)
然而,这也没有任何意义.
点击视频时执行的代码:
NSString *path = [[NSBundle mainBundle] pathForResource:currentTitle ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:path];
movieController = [[MPMoviePlayerController alloc] initWithContentURL:url];
[movieController setControlStyle:MPMovieControlStyleFullscreen];
[movieController setFullscreen:YES];
movieController.view.frame = self.view.bounds;
[self.view addSubview:movieController.view];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
在视频完成或用户点击完成时执行的代码是:
NSLog(@"movieController moviePlayBackDidFinish");
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[movieController setFullscreen:NO animated:NO];
[movieController.view removeFromSuperview];
[movieController release];
LiveEventsView *liveEventsView = [[LiveEventsView alloc] initWithNibName:@"LiveEventsView" bundle:nil];
UIView *currentView = self.view;
UIView *theWindow = [currentView superview];
UIView *newView = liveEventsView.view;
newView.frame = CGRectMake(0, 20, …Run Code Online (Sandbox Code Playgroud) 我刚开始使用git.我从master创建了branch-A.我在branch-A中创建了文件abc.txt,并成功地将branch-A合并到master中.现在我在branch-A中使用相同的文件,并希望将master(即abc.txt)文件合并到branch-A(abc.txt)文件中.我尝试了"git checkout master abc.txt"但它用master的abc.txt替换了branch-A文件.
我知道"git merge master"会做这项工作,但如果有人能告诉我如何将单个文件合并到当前分支中.
提前致谢
我有一个带有多个 UI 元素的自定义 UICollectionViewCell,在代码中使用 AutoLayout 设置进行布局。
在较大的设备(iPhone 6 及更高版本)上,一切都按预期工作。
然而,在较小的设备上,多行 UILabel 会中断,但仅(似乎)在重用后才会中断。
在初始显示时,第一个单元格如下所示:
在单元格滚动出屏幕并重新打开后,它看起来像这样:
这些是在标签上设置的约束:
descriptionLabel.centerXAnchor.constraint(equalTo: firstButton.centerXAnchor),
descriptionLabel.leadingAnchor.constraint(equalTo: otherLabel.leadingAnchor),
descriptionLabel.topAnchor.constraint(equalTo: firstButton.bottomAnchor, constant: 15),
secondButton.topAnchor.constraint(greaterThanOrEqualTo: descriptionLabel.bottomAnchor, constant: 20),
Run Code Online (Sandbox Code Playgroud)
我觉得这与greaterThanOrEqualTo约束有关,但如果我用一个普通的旧equalTo约束替换它,布局就会变得疯狂,标签缩小到只适合一行。