1
好吧,我想要建立一个倒数计时器NSTextfield
和NSStepper
来增加它。 两者都具有绑定到ModelKeyPath
中Interface Builder
中的同一个int属性。为了将int值输出格式化为00:00:00,我在IB
中添加了NSDateFormatter
到NSTextfield
。NSDateformatter在NSTextfield的界面生成器中添加添加GMT差异
它的工作,但是当我运行该应用程序时,添加了与我的情况+001格林威治时间差异。 的int值应为0,但文本框显示01:00:00
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
self.countdownTimer = [[Timer alloc] init];
[self.countdownTimer setTimerCount:0];
}
我用这个解决方案做了编程:Convert Seconds Integer To HH:MM, iPhone ,但我想用NSDateFormatter
。帮助赞赏。
将格式化程序的时区设置为当前时区 – 2013-03-13 15:29:52
Thx用于快速回答,因此我必须以编程方式设置NSDateformatter,因为我无法在Inspector中执行此操作? – seinfeld 2013-03-13 15:47:21
有一个相对日期复选框,但我真的不知道那是干什么..你可以很容易地创建一个,在'-awakeFromNib'中创建一个格式化程序,并使用'-addFormatter:' – 2013-03-13 16:37:25