OSDN Git Service

24時間以上表示出来るフォーマッタを作成
authormasakih <masakih@users.sourceforge.jp>
Sun, 22 Jun 2014 13:20:41 +0000 (22:20 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 22 Jun 2014 13:20:41 +0000 (22:20 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMTimerCountFormatter.h [new file with mode: 0644]
KCD/HMTimerCountFormatter.m [new file with mode: 0644]
KCD/ja.lproj/HMDocksViewController.xib

index d8bb873..2731f50 100644 (file)
@@ -21,6 +21,7 @@
                F426802E194D0FFD00B2C27F /* HMMemberShip3Command.m in Sources */ = {isa = PBXBuildFile; fileRef = F426802D194D0FFD00B2C27F /* HMMemberShip3Command.m */; };
                F4268031194D1B1A00B2C27F /* HMChangeHenseiCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4268030194D1B1A00B2C27F /* HMChangeHenseiCommand.m */; };
                F4268034195332A000B2C27F /* HMPowerUpCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4268033195332A000B2C27F /* HMPowerUpCommand.m */; };
+               F42680371957000200B2C27F /* HMTimerCountFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = F42680361957000200B2C27F /* HMTimerCountFormatter.m */; };
                F43E67B718BE02A10087E5B6 /* STypeShortName.plist in Resources */ = {isa = PBXBuildFile; fileRef = F43E67B618BE02A10087E5B6 /* STypeShortName.plist */; };
                F43E67B918BE060E0087E5B6 /* LevelUpExp.plist in Resources */ = {isa = PBXBuildFile; fileRef = F43E67B818BE060E0087E5B6 /* LevelUpExp.plist */; };
                F4513EDD18B619B600073552 /* HMCoreDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EDC18B619B600073552 /* HMCoreDataManager.m */; };
                F4268030194D1B1A00B2C27F /* HMChangeHenseiCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMChangeHenseiCommand.m; sourceTree = "<group>"; };
                F4268032195332A000B2C27F /* HMPowerUpCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMPowerUpCommand.h; sourceTree = "<group>"; };
                F4268033195332A000B2C27F /* HMPowerUpCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMPowerUpCommand.m; sourceTree = "<group>"; };
+               F42680351957000200B2C27F /* HMTimerCountFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMTimerCountFormatter.h; sourceTree = "<group>"; };
+               F42680361957000200B2C27F /* HMTimerCountFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMTimerCountFormatter.m; sourceTree = "<group>"; };
                F43E67B618BE02A10087E5B6 /* STypeShortName.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = STypeShortName.plist; sourceTree = "<group>"; };
                F43E67B818BE060E0087E5B6 /* LevelUpExp.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = LevelUpExp.plist; sourceTree = "<group>"; };
                F4513EDB18B619B600073552 /* HMCoreDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMCoreDataManager.h; sourceTree = "<group>"; };
                                F4B3DC2018DECF570011B4FC /* HMTSVSupport.m */,
                                F4131EE71911445F004F7F9A /* HMSlotItemEquipTypeTransformer.h */,
                                F4131EE81911445F004F7F9A /* HMSlotItemEquipTypeTransformer.m */,
+                               F42680351957000200B2C27F /* HMTimerCountFormatter.h */,
+                               F42680361957000200B2C27F /* HMTimerCountFormatter.m */,
                                F4C118F318A67B05005D5B25 /* CustomHTTPProtocol */,
                                F4C1190018A6FFC2005D5B25 /* HMQueue.h */,
                                F4C1190118A6FFC2005D5B25 /* HMQueue.m */,
                                F494DC6318C608C100AE97E4 /* HMShipViewController.m in Sources */,
                                F46F104918ABAC910063E503 /* KCD.xcdatamodeld in Sources */,
                                F4B414FE18B3A66200468DAF /* HMMemberNDockCommand.m in Sources */,
+                               F42680371957000200B2C27F /* HMTimerCountFormatter.m in Sources */,
                                F4B414F218B1013C00468DAF /* HMMasterSlotItemCommand.m in Sources */,
                                F4131EE61910318F004F7F9A /* HMMasterSlotItemEquipTypeCommand.m in Sources */,
                                F4D2CBC818B0555A000EBC59 /* HMKCManagedObject.m in Sources */,
diff --git a/KCD/HMTimerCountFormatter.h b/KCD/HMTimerCountFormatter.h
new file mode 100644 (file)
index 0000000..46ccad9
--- /dev/null
@@ -0,0 +1,13 @@
+//
+//  HMTimerCountFormatter.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/06/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface HMTimerCountFormatter : NSFormatter
+
+@end
diff --git a/KCD/HMTimerCountFormatter.m b/KCD/HMTimerCountFormatter.m
new file mode 100644 (file)
index 0000000..9b8c498
--- /dev/null
@@ -0,0 +1,34 @@
+//
+//  HMTimerCountFormatter.m
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/06/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMTimerCountFormatter.h"
+
+@implementation HMTimerCountFormatter
+- (NSString *)stringForObjectValue:(id)obj
+{
+       NSInteger timeInterval = 0;
+       if([obj isKindOfClass:[NSValue class]]) {
+               timeInterval = [obj doubleValue];
+       } else if([obj isKindOfClass:[NSDate class]]) {
+               timeInterval = [obj timeIntervalSince1970];
+       } else {
+               NSLog(@"obj class is %@", NSStringFromClass([obj class]));
+               return @"";
+       }
+       
+       timeInterval += [[NSTimeZone systemTimeZone] secondsFromGMT];
+       
+       NSInteger hour = timeInterval / (60 * 60);
+       timeInterval -= hour * 60 * 60;
+       NSInteger minutes = timeInterval / 60;
+       timeInterval -= minutes * 60;
+       NSInteger seconds = timeInterval;
+       
+       return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", hour, minutes, seconds];
+}
+@end
index 6d79e48..4448f85 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
-        <deployment version="1070" defaultVersion="1080" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
+        <deployment version="1070" defaultVersion="1090" identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="HMDocksViewController">
@@ -62,8 +62,8 @@
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sTn-uJ-Phx">
                     <rect key="frame" x="87" y="279" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="BJE-Ig-1at">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="MUu-id-yAZ"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="BJE-Ig-1at">
+                        <customFormatter key="formatter" id="9Rm-sQ-KzG" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -88,8 +88,8 @@
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="U7b-9S-sWb">
                     <rect key="frame" x="100" y="178" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="iv8-oM-0Fo">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="SFs-FI-wPI"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="iv8-oM-0Fo">
+                        <customFormatter key="formatter" id="uTW-Si-vAP" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -97,8 +97,8 @@
                     <connections>
                         <binding destination="-2" name="value" keyPath="nDock1Time" id="GqF-Qw-Z4Y">
                             <dictionary key="options">
-                                <string key="NSNullPlaceholder">--:--:--</string>
                                 <bool key="NSContinuouslyUpdatesValue" value="YES"/>
+                                <string key="NSNullPlaceholder">--:--:--</string>
                             </dictionary>
                         </binding>
                     </connections>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1j4-Kg-am8">
                     <rect key="frame" x="100" y="55" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="5SQ-4h-gVc">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="iEU-EI-neV"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="5SQ-4h-gVc">
+                        <customFormatter key="formatter" id="fOY-bM-qRR" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YPL-iZ-5QI">
                     <rect key="frame" x="87" y="256" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="uZ7-H0-10h">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="2GZ-Uz-iAI"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="uZ7-H0-10h">
+                        <customFormatter key="formatter" id="XJq-qE-ggs" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aaL-Hq-rXW">
                     <rect key="frame" x="87" y="233" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="KdJ-xQ-eVC">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="86I-wZ-ZEB"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="KdJ-xQ-eVC">
+                        <customFormatter key="formatter" id="lcg-8G-Dru" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mAQ-lg-uXF">
                     <rect key="frame" x="100" y="155" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="oco-u5-uot">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="fPR-NA-TxP"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="oco-u5-uot">
+                        <customFormatter key="formatter" id="n6E-LC-O0m" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0Ep-sM-xII">
                     <rect key="frame" x="100" y="132" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="YbO-M6-FUI">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="w5f-eG-6gx"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="YbO-M6-FUI">
+                        <customFormatter key="formatter" id="XN3-A0-NNc" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zee-D4-ZGG">
                     <rect key="frame" x="100" y="109" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="rFg-0M-tbw">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="nDW-Qt-yEs"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="rFg-0M-tbw">
+                        <customFormatter key="formatter" id="aaT-2p-6sV" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="txP-dd-uyL">
                     <rect key="frame" x="100" y="32" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="Bnk-cQ-3F5">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="Rwh-QY-sHe"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="Bnk-cQ-3F5">
+                        <customFormatter key="formatter" id="pyU-qN-RwB" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VoE-sV-bbn">
                     <rect key="frame" x="246" y="55" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="769-Rr-iNm">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="pjt-k9-PCo"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="769-Rr-iNm">
+                        <customFormatter key="formatter" id="wwc-Kj-i2T" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cB6-7z-cj7">
                     <rect key="frame" x="246" y="32" width="62" height="17"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
-                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00:00" id="IP7-Yh-Z7X">
-                        <dateFormatter key="formatter" formatterBehavior="custom10_4" dateStyle="short" dateFormat="HH:mm:ss" id="RMH-5i-VOT"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="IP7-Yh-Z7X">
+                        <customFormatter key="formatter" id="5gk-HQ-Ks2" customClass="HMTimerCountFormatter"/>
                         <font key="font" size="13" name="AquaKana"/>
                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
             </subviews>
         </customView>
     </objects>
-</document>
\ No newline at end of file
+</document>