clang format, interaction updates.
This commit is contained in:
parent
d2a0a7b04b
commit
6a67571360
65
.clang-format
Normal file
65
.clang-format
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: true
|
||||||
|
AlignEscapedNewlinesLeft: false
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: false
|
||||||
|
AlwaysBreakTemplateDeclarations: false
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BinPackParameters: true
|
||||||
|
BinPackArguments: true
|
||||||
|
ColumnLimit: 80
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
IndentFunctionDeclarationAfterType: false
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Right
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
Standard: Cpp11
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 8
|
||||||
|
UseTab: Never
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
DisableFormat: false
|
||||||
|
...
|
||||||
|
|
||||||
@ -18,9 +18,9 @@
|
|||||||
E22EE9EA1C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9E91C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m */; };
|
E22EE9EA1C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9E91C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m */; };
|
||||||
E22EE9F51C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */; };
|
E22EE9F51C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */; };
|
||||||
E28E106D1C9FF93D006E2C6B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */; };
|
E28E106D1C9FF93D006E2C6B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */; };
|
||||||
E28E10711CA01EC9006E2C6B /* Menu.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10701CA01EC9006E2C6B /* Menu.plist */; };
|
E28E10711CA01EC9006E2C6B /* MENU.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10701CA01EC9006E2C6B /* MENU.plist */; };
|
||||||
E28E10731CA0375F006E2C6B /* Route.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10721CA0375F006E2C6B /* Route.plist */; };
|
E28E10731CA0375F006E2C6B /* ROUTE.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10721CA0375F006E2C6B /* ROUTE.plist */; };
|
||||||
E28E10751CA037F2006E2C6B /* Perf Init.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10741CA037F2006E2C6B /* Perf Init.plist */; };
|
E28E10751CA037F2006E2C6B /* PERF INIT.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10741CA037F2006E2C6B /* PERF INIT.plist */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -62,9 +62,9 @@
|
|||||||
E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FMC_Planner_2UITests.m; sourceTree = "<group>"; };
|
E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FMC_Planner_2UITests.m; sourceTree = "<group>"; };
|
||||||
E22EE9F61C9DB7B4001F5BC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
E22EE9F61C9DB7B4001F5BC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||||
E28E10701CA01EC9006E2C6B /* Menu.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Menu.plist; sourceTree = "<group>"; };
|
E28E10701CA01EC9006E2C6B /* MENU.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MENU.plist; sourceTree = "<group>"; };
|
||||||
E28E10721CA0375F006E2C6B /* Route.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Route.plist; sourceTree = "<group>"; };
|
E28E10721CA0375F006E2C6B /* ROUTE.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ROUTE.plist; sourceTree = "<group>"; };
|
||||||
E28E10741CA037F2006E2C6B /* Perf Init.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Perf Init.plist"; sourceTree = "<group>"; };
|
E28E10741CA037F2006E2C6B /* PERF INIT.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "PERF INIT.plist"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -172,9 +172,9 @@
|
|||||||
E28E106F1CA01EA1006E2C6B /* Screens */ = {
|
E28E106F1CA01EA1006E2C6B /* Screens */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E28E10701CA01EC9006E2C6B /* Menu.plist */,
|
E28E10701CA01EC9006E2C6B /* MENU.plist */,
|
||||||
E28E10721CA0375F006E2C6B /* Route.plist */,
|
E28E10721CA0375F006E2C6B /* ROUTE.plist */,
|
||||||
E28E10741CA037F2006E2C6B /* Perf Init.plist */,
|
E28E10741CA037F2006E2C6B /* PERF INIT.plist */,
|
||||||
);
|
);
|
||||||
name = Screens;
|
name = Screens;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -285,11 +285,11 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
E28E10751CA037F2006E2C6B /* Perf Init.plist in Resources */,
|
E28E10751CA037F2006E2C6B /* PERF INIT.plist in Resources */,
|
||||||
E22EE9DF1C9DB7B3001F5BC0 /* LaunchScreen.storyboard in Resources */,
|
E22EE9DF1C9DB7B3001F5BC0 /* LaunchScreen.storyboard in Resources */,
|
||||||
E28E10711CA01EC9006E2C6B /* Menu.plist in Resources */,
|
E28E10711CA01EC9006E2C6B /* MENU.plist in Resources */,
|
||||||
E22EE9DC1C9DB7B3001F5BC0 /* Assets.xcassets in Resources */,
|
E22EE9DC1C9DB7B3001F5BC0 /* Assets.xcassets in Resources */,
|
||||||
E28E10731CA0375F006E2C6B /* Route.plist in Resources */,
|
E28E10731CA0375F006E2C6B /* ROUTE.plist in Resources */,
|
||||||
E22EE9DA1C9DB7B3001F5BC0 /* Main.storyboard in Resources */,
|
E22EE9DA1C9DB7B3001F5BC0 /* Main.storyboard in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
@ -21,8 +21,8 @@
|
|||||||
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6JY-wx-fWz">
|
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6JY-wx-fWz">
|
||||||
<rect key="frame" x="20" y="348" width="280" height="205"/>
|
<rect key="frame" x="20" y="348" width="280" height="205"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="280" id="e41-RH-0Kp"/>
|
<constraint firstAttribute="width" constant="280" id="AFD-aL-Jhp"/>
|
||||||
<constraint firstAttribute="height" constant="205" id="gDi-3X-8ir"/>
|
<constraint firstAttribute="height" constant="205" id="jsn-LS-C1H"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<connections>
|
<connections>
|
||||||
<segue destination="wIq-rl-lQa" kind="embed" identifier="keyboard" id="iRf-Lv-WlY"/>
|
<segue destination="wIq-rl-lQa" kind="embed" identifier="keyboard" id="iRf-Lv-WlY"/>
|
||||||
@ -37,11 +37,11 @@
|
|||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="0.33000000000000002" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.33000000000000002" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
|
<constraint firstItem="6JY-wx-fWz" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="BoO-h6-sdM"/>
|
||||||
<constraint firstItem="uVT-4Z-zN6" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" id="PSi-Ow-TcU"/>
|
<constraint firstItem="uVT-4Z-zN6" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" id="PSi-Ow-TcU"/>
|
||||||
<constraint firstItem="uVT-4Z-zN6" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="RA4-ch-Czz"/>
|
<constraint firstItem="uVT-4Z-zN6" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="RA4-ch-Czz"/>
|
||||||
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="6JY-wx-fWz" secondAttribute="bottom" constant="15" id="W0b-Iv-8Gf"/>
|
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="6JY-wx-fWz" secondAttribute="bottom" constant="15" id="W0b-Iv-8Gf"/>
|
||||||
<constraint firstItem="6JY-wx-fWz" firstAttribute="top" secondItem="uVT-4Z-zN6" secondAttribute="bottom" constant="8" id="ixg-ql-E0A"/>
|
<constraint firstItem="6JY-wx-fWz" firstAttribute="top" secondItem="uVT-4Z-zN6" secondAttribute="bottom" constant="8" id="ixg-ql-E0A"/>
|
||||||
<constraint firstItem="6JY-wx-fWz" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="kbH-th-QDl"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="uVT-4Z-zN6" secondAttribute="trailing" constant="20" id="v0r-d2-OoH"/>
|
<constraint firstAttribute="trailing" secondItem="uVT-4Z-zN6" secondAttribute="trailing" constant="20" id="v0r-d2-OoH"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
@ -446,6 +446,10 @@
|
|||||||
<scene sceneID="yrV-d4-XU2">
|
<scene sceneID="yrV-d4-XU2">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="Ugt-3C-LsO" customClass="ViewControllerScreen" sceneMemberID="viewController">
|
<viewController id="Ugt-3C-LsO" customClass="ViewControllerScreen" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="bgX-Bo-CkS"/>
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="gQe-JE-c2y"/>
|
||||||
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="2YN-Dg-9F2">
|
<view key="view" contentMode="scaleToFill" id="2YN-Dg-9F2">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="280" height="320"/>
|
<rect key="frame" x="0.0" y="0.0" width="280" height="320"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
|||||||
@ -53,11 +53,11 @@
|
|||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) {
|
} else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) {
|
||||||
_main.screen.Scratchpad.text = @"DELETE";
|
_main.screen.Scratchpad.text = @"DELETE";
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Top"]) {
|
} else if ([sender.restorationIdentifier isEqualToString:@"Top"]) {
|
||||||
[_main.screen loadScreen:@"Menu"];
|
[_main.screen loadScreen:@"MENU"];
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Mid"]) {
|
} else if ([sender.restorationIdentifier isEqualToString:@"Mid"]) {
|
||||||
[_main.screen loadScreen:@"Perf Init"];
|
[_main.screen loadScreen:@"PERF INIT"];
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Bot"]) {
|
} else if ([sender.restorationIdentifier isEqualToString:@"Bot"]) {
|
||||||
[_main.screen loadScreen:@"Route"];
|
[_main.screen loadScreen:@"ROUTE"];
|
||||||
} else {
|
} else {
|
||||||
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
||||||
stringByAppendingString:sender.titleLabel.text];
|
stringByAppendingString:sender.titleLabel.text];
|
||||||
|
|||||||
@ -11,119 +11,125 @@
|
|||||||
@implementation ViewControllerScreen
|
@implementation ViewControllerScreen
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
// Init Start Page
|
// Init Start Page
|
||||||
[self clearScreen];
|
[self clearScreen];
|
||||||
_Header.text = @"START";
|
_Header.text = @"START";
|
||||||
_Scratchpad.text = @"";
|
_Scratchpad.text = @"";
|
||||||
|
|
||||||
// Tap gesture shit
|
// Tap gesture shit
|
||||||
for (UILabel *label in _LSK) {
|
for (UILabel *label in _LSK) {
|
||||||
label.adjustsFontSizeToFitWidth = YES;
|
label.adjustsFontSizeToFitWidth = YES;
|
||||||
label.userInteractionEnabled = YES;
|
UITapGestureRecognizer *reg = [[UITapGestureRecognizer alloc]
|
||||||
UITapGestureRecognizer *reg =
|
initWithTarget:self
|
||||||
[[UITapGestureRecognizer alloc] initWithTarget:self
|
action:@selector(enterLSK:)];
|
||||||
action:@selector(enterLSK:)];
|
[reg setNumberOfTapsRequired:1];
|
||||||
[reg setNumberOfTapsRequired:1];
|
[reg setNumberOfTouchesRequired:1];
|
||||||
[reg setNumberOfTouchesRequired:1];
|
[label addGestureRecognizer:reg];
|
||||||
[label addGestureRecognizer:reg];
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated {
|
- (void)viewDidAppear:(BOOL)animated {
|
||||||
[super viewDidAppear:YES];
|
[super viewDidAppear:YES];
|
||||||
[self loadScreen:@"Menu"];
|
[self loadScreen:@"MENU"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLayoutSubviews {
|
- (void)viewDidLayoutSubviews {
|
||||||
_FrameHeight.constant = self.view.frame.size.height / 14.5;
|
_FrameHeight.constant = self.view.frame.size.height / 14.5;
|
||||||
// Size and LineBreak
|
// Size and LineBreak
|
||||||
|
|
||||||
_Header.font = [self findAdaptiveFontForUILabelSize:_Header.frame.size
|
_Header.font = [self findAdaptiveFontForUILabelSize:_Header.frame.size
|
||||||
withMinimumSize:5
|
withMinimumSize:5
|
||||||
withMod:0.7];
|
withMod:0.7];
|
||||||
_Header.adjustsFontSizeToFitWidth = YES;
|
_Header.adjustsFontSizeToFitWidth = YES;
|
||||||
_Scratchpad.font = [self findAdaptiveFontForUILabelSize:_Scratchpad.frame.size
|
_Scratchpad.font =
|
||||||
|
[self findAdaptiveFontForUILabelSize:_Scratchpad.frame.size
|
||||||
|
withMinimumSize:5
|
||||||
|
withMod:0.7];
|
||||||
|
_Scratchpad.adjustsFontSizeToFitWidth = YES;
|
||||||
|
for (UILabel *label in _LSK) {
|
||||||
|
label.font = [self findAdaptiveFontForUILabelSize:_Header.frame.size
|
||||||
withMinimumSize:5
|
withMinimumSize:5
|
||||||
withMod:0.7];
|
withMod:0.6];
|
||||||
_Scratchpad.adjustsFontSizeToFitWidth = YES;
|
}
|
||||||
for (UILabel *label in _LSK) {
|
|
||||||
label.font = [self findAdaptiveFontForUILabelSize:_Header.frame.size
|
|
||||||
withMinimumSize:5
|
|
||||||
withMod:0.6];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)clearScreen {
|
- (void)clearScreen {
|
||||||
for (UILabel *label in _LSK) {
|
for (UILabel *label in _LSK) {
|
||||||
label.text = @"";
|
label.text = @"";
|
||||||
}
|
}
|
||||||
_Scratchpad.text = @"";
|
_Scratchpad.text = @"";
|
||||||
_Header.text = @"";
|
_Header.text = @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)enterLSK:(UITapGestureRecognizer *)tapReg {
|
- (void)enterLSK:(UITapGestureRecognizer *)tapReg {
|
||||||
if ([_Scratchpad.text isEqualToString:@"DELETE"]) {
|
if ([_Scratchpad.text isEqualToString:@"DELETE"]) {
|
||||||
((UILabel *)tapReg.view).text = @"";
|
((UILabel *)tapReg.view).text = @"";
|
||||||
} else {
|
} else {
|
||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
}
|
}
|
||||||
_Scratchpad.text = @"";
|
_Scratchpad.text = @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
- (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
||||||
withMinimumSize:(NSInteger)minSize
|
withMinimumSize:(NSInteger)minSize
|
||||||
withMod:(float)mod {
|
withMod:(float)mod {
|
||||||
UIFont *tempFont = nil;
|
UIFont *tempFont = nil;
|
||||||
NSString *testString =
|
NSString *testString =
|
||||||
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
NSInteger tempMin = minSize / mod;
|
NSInteger tempMin = minSize / mod;
|
||||||
NSInteger tempMax = 256;
|
NSInteger tempMax = 256;
|
||||||
NSInteger mid = 0;
|
NSInteger mid = 0;
|
||||||
NSInteger difference = 0;
|
NSInteger difference = 0;
|
||||||
|
|
||||||
while (tempMin <= tempMax) {
|
while (tempMin <= tempMax) {
|
||||||
mid = tempMin + (tempMax - tempMin) / 2;
|
mid = tempMin + (tempMax - tempMin) / 2;
|
||||||
tempFont = [UIFont systemFontOfSize:mid];
|
tempFont = [UIFont systemFontOfSize:mid];
|
||||||
difference =
|
difference =
|
||||||
labelSize.height / mod -
|
labelSize.height / mod -
|
||||||
[testString
|
[testString
|
||||||
sizeWithAttributes:[NSDictionary
|
sizeWithAttributes:
|
||||||
dictionaryWithObject:tempFont
|
[NSDictionary dictionaryWithObject:tempFont
|
||||||
forKey:NSFontAttributeName]]
|
forKey:NSFontAttributeName]]
|
||||||
.height;
|
.height;
|
||||||
|
|
||||||
if (mid == tempMin || mid == tempMax) {
|
if (mid == tempMin || mid == tempMax) {
|
||||||
if (difference < 0) {
|
if (difference < 0) {
|
||||||
return [UIFont systemFontOfSize:(mid - 1)];
|
return [UIFont systemFontOfSize:(mid - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [UIFont systemFontOfSize:mid];
|
return [UIFont systemFontOfSize:mid];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difference < 0) {
|
||||||
|
tempMax = mid - 1;
|
||||||
|
} else if (difference > 0) {
|
||||||
|
tempMin = mid + 1;
|
||||||
|
} else {
|
||||||
|
return [UIFont systemFontOfSize:mid];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (difference < 0) {
|
return [UIFont systemFontOfSize:mid];
|
||||||
tempMax = mid - 1;
|
|
||||||
} else if (difference > 0) {
|
|
||||||
tempMin = mid + 1;
|
|
||||||
} else {
|
|
||||||
return [UIFont systemFontOfSize:mid];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [UIFont systemFontOfSize:mid];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadScreen:(NSString *)screenName {
|
- (void)loadScreen:(NSString *)screenName {
|
||||||
_Header.text = screenName;
|
_Header.text = screenName;
|
||||||
NSArray *screen = [[NSArray alloc]
|
NSArray *screen =
|
||||||
initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:screenName
|
[[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle]
|
||||||
|
pathForResource:screenName
|
||||||
ofType:@"plist"]];
|
ofType:@"plist"]];
|
||||||
for (int i = 0; i < _Desc.count; i++) {
|
for (int i = 0; i < _Desc.count; i++) {
|
||||||
((UILabel *)_Desc[i]).text = [NSString stringWithFormat:@"%@\n", screen[i]];
|
((UILabel *)_Desc[i]).text =
|
||||||
}
|
[NSString stringWithFormat:@"%@\n", screen[i]];
|
||||||
|
if (![screen[i] isEqualToString:@""] ||
|
||||||
|
[_Header.text isEqualToString:@"ROUTE"]) {
|
||||||
|
((UILabel *)_LSK[i]).userInteractionEnabled = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user