View updated, outsourced, working keyboard and LSK
This commit is contained in:
parent
1c21a2f0c3
commit
c7cf51b2ad
@ -7,6 +7,8 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
E227C7831C9F42AB00DE0CA4 /* ViewControllerKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = E227C7821C9F42AB00DE0CA4 /* ViewControllerKeyboard.m */; };
|
||||||
|
E227C7861C9F474100DE0CA4 /* ViewControllerScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = E227C7851C9F474100DE0CA4 /* ViewControllerScreen.m */; };
|
||||||
E22EE9D11C9DB7B3001F5BC0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9D01C9DB7B3001F5BC0 /* main.m */; };
|
E22EE9D11C9DB7B3001F5BC0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9D01C9DB7B3001F5BC0 /* main.m */; };
|
||||||
E22EE9D41C9DB7B3001F5BC0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9D31C9DB7B3001F5BC0 /* AppDelegate.m */; };
|
E22EE9D41C9DB7B3001F5BC0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9D31C9DB7B3001F5BC0 /* AppDelegate.m */; };
|
||||||
E22EE9D71C9DB7B3001F5BC0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9D61C9DB7B3001F5BC0 /* ViewController.m */; };
|
E22EE9D71C9DB7B3001F5BC0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9D61C9DB7B3001F5BC0 /* ViewController.m */; };
|
||||||
@ -35,6 +37,10 @@
|
|||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
E227C7811C9F42AB00DE0CA4 /* ViewControllerKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewControllerKeyboard.h; sourceTree = "<group>"; };
|
||||||
|
E227C7821C9F42AB00DE0CA4 /* ViewControllerKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewControllerKeyboard.m; sourceTree = "<group>"; };
|
||||||
|
E227C7841C9F474100DE0CA4 /* ViewControllerScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewControllerScreen.h; sourceTree = "<group>"; };
|
||||||
|
E227C7851C9F474100DE0CA4 /* ViewControllerScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewControllerScreen.m; sourceTree = "<group>"; };
|
||||||
E22EE9CC1C9DB7B3001F5BC0 /* FMC Planner 2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FMC Planner 2.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
E22EE9CC1C9DB7B3001F5BC0 /* FMC Planner 2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FMC Planner 2.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
E22EE9D01C9DB7B3001F5BC0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
E22EE9D01C9DB7B3001F5BC0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||||
E22EE9D21C9DB7B3001F5BC0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
E22EE9D21C9DB7B3001F5BC0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||||
@ -110,6 +116,10 @@
|
|||||||
E22EE9DD1C9DB7B3001F5BC0 /* LaunchScreen.storyboard */,
|
E22EE9DD1C9DB7B3001F5BC0 /* LaunchScreen.storyboard */,
|
||||||
E22EE9E01C9DB7B3001F5BC0 /* Info.plist */,
|
E22EE9E01C9DB7B3001F5BC0 /* Info.plist */,
|
||||||
E22EE9CF1C9DB7B3001F5BC0 /* Supporting Files */,
|
E22EE9CF1C9DB7B3001F5BC0 /* Supporting Files */,
|
||||||
|
E227C7811C9F42AB00DE0CA4 /* ViewControllerKeyboard.h */,
|
||||||
|
E227C7821C9F42AB00DE0CA4 /* ViewControllerKeyboard.m */,
|
||||||
|
E227C7841C9F474100DE0CA4 /* ViewControllerScreen.h */,
|
||||||
|
E227C7851C9F474100DE0CA4 /* ViewControllerScreen.m */,
|
||||||
);
|
);
|
||||||
path = "FMC Planner 2";
|
path = "FMC Planner 2";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -276,6 +286,8 @@
|
|||||||
E22EE9D71C9DB7B3001F5BC0 /* ViewController.m in Sources */,
|
E22EE9D71C9DB7B3001F5BC0 /* ViewController.m in Sources */,
|
||||||
E22EE9D41C9DB7B3001F5BC0 /* AppDelegate.m in Sources */,
|
E22EE9D41C9DB7B3001F5BC0 /* AppDelegate.m in Sources */,
|
||||||
E22EE9D11C9DB7B3001F5BC0 /* main.m in Sources */,
|
E22EE9D11C9DB7B3001F5BC0 /* main.m in Sources */,
|
||||||
|
E227C7831C9F42AB00DE0CA4 /* ViewControllerKeyboard.m in Sources */,
|
||||||
|
E227C7861C9F474100DE0CA4 /* ViewControllerScreen.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -418,6 +430,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
INFOPLIST_FILE = "FMC Planner 2/Info.plist";
|
INFOPLIST_FILE = "FMC Planner 2/Info.plist";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.weebly.alikja.FMC-Planner-2";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.weebly.alikja.FMC-Planner-2";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@ -431,6 +444,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
INFOPLIST_FILE = "FMC Planner 2/Info.plist";
|
INFOPLIST_FILE = "FMC Planner 2/Info.plist";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.weebly.alikja.FMC-Planner-2";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.weebly.alikja.FMC-Planner-2";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|||||||
@ -2,4 +2,54 @@
|
|||||||
<Bucket
|
<Bucket
|
||||||
type = "1"
|
type = "1"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
|
<Breakpoints>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "FMC Planner 2/ViewController.m"
|
||||||
|
timestampString = "480202380.506075"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "20"
|
||||||
|
endingLineNumber = "20"
|
||||||
|
landmarkName = "-viewDidLoad"
|
||||||
|
landmarkType = "5">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "FMC Planner 2/ViewControllerScreen.m"
|
||||||
|
timestampString = "480202890.028996"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "13"
|
||||||
|
endingLineNumber = "13"
|
||||||
|
landmarkName = "-viewDidLoad"
|
||||||
|
landmarkType = "5">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "FMC Planner 2/ViewControllerScreen.m"
|
||||||
|
timestampString = "480204314.085838"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "59"
|
||||||
|
endingLineNumber = "59"
|
||||||
|
landmarkName = "-findAdaptiveFontForUILabelSize:withMinimumSize:"
|
||||||
|
landmarkType = "5">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|||||||
@ -59,6 +59,11 @@
|
|||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "76x76",
|
"size" : "76x76",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "ipad",
|
||||||
|
"size" : "83.5x83.5",
|
||||||
|
"scale" : "2x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
|
|||||||
6
FMC Planner 2/Assets.xcassets/Contents.json
Normal file
6
FMC Planner 2/Assets.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
FMC Planner 2/Assets.xcassets/tri.imageset/Contents.json
vendored
Normal file
23
FMC Planner 2/Assets.xcassets/tri.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "triSmall.png",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "trBig.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "triBigger.png",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
FMC Planner 2/Assets.xcassets/tri.imageset/trBig.png
vendored
Normal file
BIN
FMC Planner 2/Assets.xcassets/tri.imageset/trBig.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
FMC Planner 2/Assets.xcassets/tri.imageset/triBigger.png
vendored
Normal file
BIN
FMC Planner 2/Assets.xcassets/tri.imageset/triBigger.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
BIN
FMC Planner 2/Assets.xcassets/tri.imageset/triSmall.png
vendored
Normal file
BIN
FMC Planner 2/Assets.xcassets/tri.imageset/triSmall.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@ -1,7 +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="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--View Controller-->
|
<!--View Controller-->
|
||||||
@ -15,7 +16,6 @@
|
|||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<animations/>
|
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||||
</view>
|
</view>
|
||||||
</viewController>
|
</viewController>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -6,27 +6,17 @@
|
|||||||
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#import "ViewControllerKeyboard.h"
|
||||||
|
#import "ViewControllerScreen.h"
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface ViewController : UIViewController
|
@interface ViewController : UIViewController
|
||||||
|
|
||||||
@property(nonatomic) BOOL alphaOn;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) NSArray *alphabet;
|
|
||||||
@property(strong, nonatomic) NSArray *numeric;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutletCollection(UIButton) NSArray *Keys;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UIView *backdropKeys;
|
@property(strong, nonatomic) IBOutlet UIView *backdropKeys;
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UIView *backdropScreen;
|
@property(strong, nonatomic) IBOutlet UIView *backdropScreen;
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutletCollection(UILabel) NSArray *ScreenLabels;
|
@property(strong, nonatomic) ViewControllerScreen *screen;
|
||||||
|
@property(strong, nonatomic) ViewControllerKeyboard *keys;
|
||||||
@property(strong, nonatomic) IBOutlet UILabel *Scratchpad;
|
|
||||||
|
|
||||||
@property(strong, nonatomic) IBOutlet UILabel *Header;
|
|
||||||
|
|
||||||
- (IBAction)KeyTaps:(UIButton *)sender;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -13,89 +13,22 @@
|
|||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view, typically from a nib.
|
// Do any additional setup after loading the view, typically from a nib.
|
||||||
_alphaOn = true;
|
|
||||||
_alphabet = [[NSArray alloc]
|
|
||||||
initWithObjects:@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I",
|
|
||||||
@"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R",
|
|
||||||
@"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", @"SP",
|
|
||||||
@"CLR", @"DEL", @"NUM", nil];
|
|
||||||
_numeric = [[NSArray alloc]
|
|
||||||
initWithObjects:@"1", @"2", @"3", @"", @"", @"", @"4", @"5", @"6",
|
|
||||||
@"", @"", @"", @"7", @"8", @"9", @"", @"", @"",
|
|
||||||
@".", @"0", @"/", @"", @"", @"", @"", @"", @"SP",
|
|
||||||
@"CLR", @"DEL", @"LET", nil];
|
|
||||||
|
|
||||||
// Round corners
|
// Round corners
|
||||||
_backdropKeys.layer.cornerRadius = 5;
|
_backdropKeys.layer.cornerRadius = 5;
|
||||||
_backdropKeys.layer.masksToBounds = YES;
|
_backdropKeys.layer.masksToBounds = YES;
|
||||||
_backdropScreen.layer.cornerRadius = 5;
|
_backdropScreen.layer.cornerRadius = 5;
|
||||||
_backdropScreen.layer.masksToBounds = YES;
|
_backdropScreen.layer.masksToBounds = YES;
|
||||||
for (UIButton *but in _Keys) {
|
|
||||||
but.layer.cornerRadius = 5;
|
|
||||||
but.layer.masksToBounds = YES;
|
|
||||||
}
|
|
||||||
// Set Font Size
|
|
||||||
if (self.view.frame.size.height == 480) {
|
|
||||||
for (UILabel *label in _ScreenLabels) {
|
|
||||||
label.font = [UIFont systemFontOfSize:14];
|
|
||||||
}
|
|
||||||
_Header.font = [UIFont systemFontOfSize:14];
|
|
||||||
_Scratchpad.font = [UIFont systemFontOfSize:14];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init Start Page
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||||
[self clearScreen];
|
NSString *segueName = segue.identifier;
|
||||||
_Header.text = @"START";
|
if ([segueName isEqualToString:@"keyboard"]) {
|
||||||
_Scratchpad.text = @"";
|
_keys = (ViewControllerKeyboard *)[segue destinationViewController];
|
||||||
}
|
_keys.main = self;
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning {
|
|
||||||
[super didReceiveMemoryWarning];
|
|
||||||
// Dispose of any resources that can be recreated.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)KeyTaps:(UIButton *)sender {
|
|
||||||
if ([sender.restorationIdentifier isEqualToString:@"Switch"]) {
|
|
||||||
_alphaOn = !_alphaOn;
|
|
||||||
[self switchKeyboard];
|
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Space"]) {
|
|
||||||
_Scratchpad.text = [_Scratchpad.text stringByAppendingString:@" "];
|
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Clear"]) {
|
|
||||||
if ([_Scratchpad.text isEqualToString:@"DELETE"]) {
|
|
||||||
_Scratchpad.text = @"";
|
|
||||||
} else if (_Scratchpad.text.length > 0) {
|
|
||||||
_Scratchpad.text =
|
|
||||||
[_Scratchpad.text substringToIndex:[_Scratchpad.text length] - 1];
|
|
||||||
}
|
|
||||||
} else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) {
|
|
||||||
_Scratchpad.text = @"DELETE";
|
|
||||||
} else {
|
|
||||||
_Scratchpad.text =
|
|
||||||
[_Scratchpad.text stringByAppendingString:sender.titleLabel.text];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)clearScreen {
|
|
||||||
for (UILabel *label in _ScreenLabels) {
|
|
||||||
label.text = @"";
|
|
||||||
}
|
|
||||||
_Scratchpad.text = @"";
|
|
||||||
_Header.text = @"";
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)switchKeyboard {
|
|
||||||
if (_alphaOn) {
|
|
||||||
for (int i = 0; i < _Keys.count; i++) {
|
|
||||||
[((UIButton *)_Keys[i]) setTitle:_alphabet[i]
|
|
||||||
forState:UIControlStateNormal];
|
|
||||||
[((UIButton *)_Keys[i]).titleLabel sizeToFit];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < _Keys.count; i++) {
|
|
||||||
[((UIButton *)_Keys[i]) setTitle:_numeric[i]
|
|
||||||
forState:UIControlStateNormal];
|
|
||||||
[((UIButton *)_Keys[i]).titleLabel sizeToFit];
|
|
||||||
}
|
}
|
||||||
|
if ([segueName isEqualToString:@"screen"]) {
|
||||||
|
_screen = (ViewControllerScreen *)[segue destinationViewController];
|
||||||
|
_screen.main = self;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
25
FMC Planner 2/ViewControllerKeyboard.h
Normal file
25
FMC Planner 2/ViewControllerKeyboard.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// ViewControllerKeyboard.h
|
||||||
|
// FMC Planner 2
|
||||||
|
//
|
||||||
|
// Created by Kilian Hofmann on 20.03.16.
|
||||||
|
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@class ViewController;
|
||||||
|
@interface ViewControllerKeyboard : UIViewController
|
||||||
|
|
||||||
|
@property(nonatomic) BOOL alphaOn;
|
||||||
|
|
||||||
|
@property(strong, nonatomic) NSArray *alphabet;
|
||||||
|
@property(strong, nonatomic) NSArray *numeric;
|
||||||
|
|
||||||
|
@property(strong, nonatomic) IBOutletCollection(UIButton) NSArray *Keys;
|
||||||
|
|
||||||
|
@property(strong, nonatomic) ViewController *main;
|
||||||
|
|
||||||
|
- (IBAction)KeyTaps:(UIButton *)sender;
|
||||||
|
|
||||||
|
@end
|
||||||
73
FMC Planner 2/ViewControllerKeyboard.m
Normal file
73
FMC Planner 2/ViewControllerKeyboard.m
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// ViewControllerKeyboard.m
|
||||||
|
// FMC Planner 2
|
||||||
|
//
|
||||||
|
// Created by Kilian Hofmann on 20.03.16.
|
||||||
|
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "ViewController.h"
|
||||||
|
#import "ViewControllerKeyboard.h"
|
||||||
|
|
||||||
|
@implementation ViewControllerKeyboard
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
// Do any additional setup after loading the view.
|
||||||
|
_alphaOn = true;
|
||||||
|
_alphabet = [[NSArray alloc]
|
||||||
|
initWithObjects:@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I",
|
||||||
|
@"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R",
|
||||||
|
@"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", @"SP",
|
||||||
|
@"CLR", @"DEL", @"NUM", nil];
|
||||||
|
_numeric = [[NSArray alloc]
|
||||||
|
initWithObjects:@"1", @"2", @"3", @"", @"", @"", @"4", @"5", @"6",
|
||||||
|
@"", @"", @"", @"7", @"8", @"9", @"", @"", @"",
|
||||||
|
@".", @"0", @"/", @"", @"", @"", @"", @"", @"SP",
|
||||||
|
@"CLR", @"DEL", @"LET", nil];
|
||||||
|
// Round button corners
|
||||||
|
for (UIButton *but in _Keys) {
|
||||||
|
but.layer.cornerRadius = 5;
|
||||||
|
but.layer.masksToBounds = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)KeyTaps:(UIButton *)sender {
|
||||||
|
if ([sender.restorationIdentifier isEqualToString:@"Switch"]) {
|
||||||
|
_alphaOn = !_alphaOn;
|
||||||
|
[self switchKeyboard];
|
||||||
|
} else if ([sender.restorationIdentifier isEqualToString:@"Space"]) {
|
||||||
|
_main.screen.Scratchpad.text =
|
||||||
|
[_main.screen.Scratchpad.text stringByAppendingString:@" "];
|
||||||
|
} else if ([sender.restorationIdentifier isEqualToString:@"Clear"]) {
|
||||||
|
if ([_main.screen.Scratchpad.text isEqualToString:@"DELETE"]) {
|
||||||
|
_main.screen.Scratchpad.text = @"";
|
||||||
|
} else if (_main.screen.Scratchpad.text.length > 0) {
|
||||||
|
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
||||||
|
substringToIndex:[_main.screen.Scratchpad.text length] - 1];
|
||||||
|
}
|
||||||
|
} else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) {
|
||||||
|
_main.screen.Scratchpad.text = @"DELETE";
|
||||||
|
} else {
|
||||||
|
_main.screen.Scratchpad.text = [_main.screen.Scratchpad.text
|
||||||
|
stringByAppendingString:sender.titleLabel.text];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)switchKeyboard {
|
||||||
|
if (_alphaOn) {
|
||||||
|
for (int i = 0; i < _Keys.count; i++) {
|
||||||
|
[((UIButton *)_Keys[i]) setTitle:_alphabet[i]
|
||||||
|
forState:UIControlStateNormal];
|
||||||
|
[((UIButton *)_Keys[i]).titleLabel sizeToFit];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < _Keys.count; i++) {
|
||||||
|
[((UIButton *)_Keys[i]) setTitle:_numeric[i]
|
||||||
|
forState:UIControlStateNormal];
|
||||||
|
[((UIButton *)_Keys[i]).titleLabel sizeToFit];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
22
FMC Planner 2/ViewControllerScreen.h
Normal file
22
FMC Planner 2/ViewControllerScreen.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// ViewControllerScreen.h
|
||||||
|
// FMC Planner 2
|
||||||
|
//
|
||||||
|
// Created by Kilian Hofmann on 20.03.16.
|
||||||
|
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@class ViewController;
|
||||||
|
@interface ViewControllerScreen : UIViewController
|
||||||
|
|
||||||
|
@property(strong, nonatomic) IBOutletCollection(UILabel) NSArray *LSK;
|
||||||
|
|
||||||
|
@property(strong, nonatomic) IBOutlet UILabel *Scratchpad;
|
||||||
|
|
||||||
|
@property(strong, nonatomic) IBOutlet UILabel *Header;
|
||||||
|
|
||||||
|
@property(strong, nonatomic) ViewController *main;
|
||||||
|
|
||||||
|
@end
|
||||||
95
FMC Planner 2/ViewControllerScreen.m
Normal file
95
FMC Planner 2/ViewControllerScreen.m
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
//
|
||||||
|
// ViewControllerScreen.m
|
||||||
|
// FMC Planner 2
|
||||||
|
//
|
||||||
|
// Created by Kilian Hofmann on 20.03.16.
|
||||||
|
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "ViewControllerScreen.h"
|
||||||
|
|
||||||
|
@implementation ViewControllerScreen
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
// Do any additional setup after loading the view.
|
||||||
|
// Init Start Page
|
||||||
|
[self clearScreen];
|
||||||
|
_Header.text = @"START";
|
||||||
|
_Scratchpad.text = @"";
|
||||||
|
|
||||||
|
// Tap gesture shit and fitToSize
|
||||||
|
for (UILabel *label in _LSK) {
|
||||||
|
label.font = [self findAdaptiveFontForUILabelSize:label.frame.size
|
||||||
|
withMinimumSize:21];
|
||||||
|
label.adjustsFontSizeToFitWidth = YES;
|
||||||
|
label.userInteractionEnabled = YES;
|
||||||
|
UITapGestureRecognizer *reg =
|
||||||
|
[[UITapGestureRecognizer alloc] initWithTarget:self
|
||||||
|
action:@selector(enterLSK:)];
|
||||||
|
[reg setNumberOfTapsRequired:1];
|
||||||
|
[reg setNumberOfTouchesRequired:1];
|
||||||
|
[label addGestureRecognizer:reg];
|
||||||
|
}
|
||||||
|
_Header.font = [self findAdaptiveFontForUILabelSize:_Header.frame.size
|
||||||
|
withMinimumSize:21];
|
||||||
|
_Header.adjustsFontSizeToFitWidth = YES;
|
||||||
|
_Scratchpad.font = [self findAdaptiveFontForUILabelSize:_Scratchpad.frame.size
|
||||||
|
withMinimumSize:21];
|
||||||
|
_Scratchpad.adjustsFontSizeToFitWidth = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)clearScreen {
|
||||||
|
for (UILabel *label in _LSK) {
|
||||||
|
label.text = @"";
|
||||||
|
}
|
||||||
|
_Scratchpad.text = @"";
|
||||||
|
_Header.text = @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)enterLSK:(UITapGestureRecognizer *)tapReg {
|
||||||
|
if ([_Scratchpad.text isEqualToString:@"DELETE"]) {
|
||||||
|
((UILabel *)tapReg.view).text = @"";
|
||||||
|
} else {
|
||||||
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
|
}
|
||||||
|
_Scratchpad.text = @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIFont *)findAdaptiveFontForUILabelSize:(CGSize)labelSize
|
||||||
|
withMinimumSize:(NSInteger)minSize {
|
||||||
|
UIFont *tempFont = nil;
|
||||||
|
NSString *testString =
|
||||||
|
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
NSInteger tempMin = minSize;
|
||||||
|
NSInteger tempMax = 256;
|
||||||
|
NSInteger mid = 0;
|
||||||
|
NSInteger difference = 0;
|
||||||
|
|
||||||
|
while (tempMin <= tempMax) {
|
||||||
|
mid = tempMin + (tempMax - tempMin) / 2;
|
||||||
|
tempFont = [UIFont systemFontOfSize:mid];
|
||||||
|
difference = labelSize.height - [testString sizeWithFont:tempFont].height;
|
||||||
|
|
||||||
|
if (mid == tempMin || mid == tempMax) {
|
||||||
|
if (difference < 0) {
|
||||||
|
return [UIFont systemFontOfSize:(mid - 1)];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [UIFont systemFontOfSize:mid];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difference < 0) {
|
||||||
|
tempMax = mid - 1;
|
||||||
|
} else if (difference > 0) {
|
||||||
|
tempMin = mid + 1;
|
||||||
|
} else {
|
||||||
|
return [UIFont systemFontOfSize:mid];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [UIFont systemFontOfSize:mid];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
Loading…
x
Reference in New Issue
Block a user