问题:
在横向模式下播放视频后,导航栏处于状态栏下方.
应用程序:
设置重现:
截图:
我正在使用自动布局,
我想制作一个较小的UISwitch,然后用view.transform = CGAffineTransformMakeScale(0.5, 0.5)它来实现它.
此开关上方还有另一个视图.此开关的前导应与此视图的前沿对齐,并且在视图和开关之间存在固定的垂直空间,如下图所示:
关于iOS7的观点
但是,iOS8上有不同的外观:
关于iOS8的观点
似乎约束不适用于此开关.
但是,我叫self.view.layoutSubviews()和
self.view.layoutIfNeeded()
它不起作用.
如何让这个开关始终贴在上面视图的右下角?
这里的开关没有按比例缩小

在我搜索了很多问题和答案后,没有好结果.所以我在这里问一下:
我想在导航栏下面添加一个搜索栏.
此搜索栏应该是固定的.就像iOS7下面的联系人一样.
任何人都可以帮我搞清楚吗?
我的意思是12:01:00,12:02:00
在iOS7中,我想在一小段时间改变时调用一个方法.换句话说,如果现在是01:55:47,那么我想在01:56:00 - > 01:57:00 - > 01:58:00调用方法...
我发现调用方法只是关于TimeInterval,但不是我想要的.
我试过这段代码:
NSTimeInterval roundedInterval = round([[NSDate date] timeIntervalSinceReferenceDate] / 60.0) * 60.0;
NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate:roundedInterval];
NSTimer *timer = [[NSTimer alloc] initWithFireDate:date
interval:60.0
target:self
selector:@selector(handleEveryMinutes:)
userInfo:nil
repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
- (void)handleEveryMinutes:(NSTimer *)timer {
NSLog(@"one minute!");
}
Run Code Online (Sandbox Code Playgroud)
但是这个方法不会在第二个0调用.
希望很酷的人可以帮助我!
- - - 我的答案 - - - -
我也弄清楚为什么我的代码工作不正常,我需要额外增加60秒到roundedInterval,这是下一分钟的确切时间.如果不添加60秒,则会传递fireDate,因此当我运行我的应用程序时,它必须立即触发.
NSTimeInterval roundedInterval = round([[NSDate date] timeIntervalSinceReferenceDate] / 60.0) * 60.0 + 60; // the extra 60 is used to set the correct …Run Code Online (Sandbox Code Playgroud) ios ×3
ios7 ×2
objective-c ×2
autolayout ×1
ios8 ×1
iphone ×1
nsdate ×1
nstimer ×1
swift ×1
uisearchbar ×1
uiswitch ×1
uitableview ×1