diff --git a/CustomKeyboard/Info.plist b/CustomKeyboard/Info.plist new file mode 100644 index 0000000..1686c1d --- /dev/null +++ b/CustomKeyboard/Info.plist @@ -0,0 +1,24 @@ + + + + + NSExtension + + NSExtensionAttributes + + IsASCIICapable + + PrefersRightToLeft + + PrimaryLanguage + en-US + RequestsOpenAccess + + + NSExtensionPointIdentifier + com.apple.keyboard-service + NSExtensionPrincipalClass + KeyboardViewController + + + diff --git a/CustomKeyboard/KeyboardViewController.h b/CustomKeyboard/KeyboardViewController.h new file mode 100644 index 0000000..ae4f910 --- /dev/null +++ b/CustomKeyboard/KeyboardViewController.h @@ -0,0 +1,12 @@ +// +// KeyboardViewController.h +// CustomKeyboard +// +// Created by Mac on 2025/10/27. +// + +#import + +@interface KeyboardViewController : UIInputViewController + +@end diff --git a/CustomKeyboard/KeyboardViewController.m b/CustomKeyboard/KeyboardViewController.m new file mode 100644 index 0000000..a55d484 --- /dev/null +++ b/CustomKeyboard/KeyboardViewController.m @@ -0,0 +1,79 @@ +// +// KeyboardViewController.m +// CustomKeyboard +// +// Created by Mac on 2025/10/27. +// + +#import "KeyboardViewController.h" + +static CGFloat KEYBOARDHEIGHT = 256; + +@interface KeyboardViewController () +@property (nonatomic, strong) UIButton *nextKeyboardButton; +@end + +@implementation KeyboardViewController + +- (void)updateViewConstraints { + [super updateViewConstraints]; + + // Add custom view sizing constraints here +} + +- (void)viewDidLoad { + [super viewDidLoad]; +// +// // Perform custom UI setup here +// self.nextKeyboardButton = [UIButton buttonWithType:UIButtonTypeSystem]; +// +// [self.nextKeyboardButton setTitle:NSLocalizedString(@"Next Keyboard", @"Title for 'Next Keyboard' button") forState:UIControlStateNormal]; +// [self.nextKeyboardButton sizeToFit]; +// self.nextKeyboardButton.translatesAutoresizingMaskIntoConstraints = NO; +// +// [self.nextKeyboardButton addTarget:self action:@selector(handleInputModeListFromView:withEvent:) forControlEvents:UIControlEventAllTouchEvents]; +// +// [self.view addSubview:self.nextKeyboardButton]; +// +// [self.nextKeyboardButton.leftAnchor constraintEqualToAnchor:self.view.leftAnchor].active = YES; +// [self.nextKeyboardButton.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor].active = YES; + + [self setupUI]; +} + + +- (void)setupUI { + CGFloat toolBarHeight = 40; + CGFloat bottom = 5; + CGFloat buttonSpace = 8; + CGFloat eachButtonHeight = (KEYBOARDHEIGHT - toolBarHeight - 10 - 8 * 3 - bottom) / 4; + + UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)]; + view.backgroundColor = [UIColor redColor]; + [self.view addSubview:view]; +} + + +- (void)viewWillLayoutSubviews +{ + self.nextKeyboardButton.hidden = !self.needsInputModeSwitchKey; + [super viewWillLayoutSubviews]; +} + +- (void)textWillChange:(id)textInput { + // The app is about to change the document's contents. Perform any preparation here. +} + +- (void)textDidChange:(id)textInput { + // The app has just changed the document's contents, the document context has been updated. + + UIColor *textColor = nil; + if (self.textDocumentProxy.keyboardAppearance == UIKeyboardAppearanceDark) { + textColor = [UIColor whiteColor]; + } else { + textColor = [UIColor blackColor]; + } + [self.nextKeyboardButton setTitleColor:textColor forState:UIControlStateNormal]; +} + +@end diff --git a/CustomKeyboard/PrefixHeader.pch b/CustomKeyboard/PrefixHeader.pch new file mode 100644 index 0000000..e416482 --- /dev/null +++ b/CustomKeyboard/PrefixHeader.pch @@ -0,0 +1,18 @@ +// +// PrefixHeader.pch +// CustomKeyboard +// +// Created by Mac on 2025/10/27. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch + +// Include any system framework and library headers here that should be included in all compilation units. +// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. + +#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width +#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.width +#define imageNamed(s) [UIImage imageNamed:s] + +#endif /* PrefixHeader_pch */ diff --git a/CustomKeyboard/View/KBToolBar.h b/CustomKeyboard/View/KBToolBar.h new file mode 100644 index 0000000..e48a19c --- /dev/null +++ b/CustomKeyboard/View/KBToolBar.h @@ -0,0 +1,16 @@ +// +// KBToolBar.h +// CustomKeyboard +// +// Created by Mac on 2025/10/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface KBToolBar : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/CustomKeyboard/View/KBToolBar.m b/CustomKeyboard/View/KBToolBar.m new file mode 100644 index 0000000..db12de3 --- /dev/null +++ b/CustomKeyboard/View/KBToolBar.m @@ -0,0 +1,20 @@ +// +// KBToolBar.m +// CustomKeyboard +// +// Created by Mac on 2025/10/27. +// + +#import "KBToolBar.h" + +@implementation KBToolBar + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/keyBoard.xcodeproj/project.pbxproj b/keyBoard.xcodeproj/project.pbxproj index 0cb4b85..10643b4 100644 --- a/keyBoard.xcodeproj/project.pbxproj +++ b/keyBoard.xcodeproj/project.pbxproj @@ -6,32 +6,70 @@ objectVersion = 77; objects = { +/* Begin PBXBuildFile section */ + 04C6EABA2EAF86530089C901 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04C6EAAE2EAF86530089C901 /* Assets.xcassets */; }; + 04C6EABC2EAF86530089C901 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04C6EAB12EAF86530089C901 /* LaunchScreen.storyboard */; }; + 04C6EABD2EAF86530089C901 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04C6EAB42EAF86530089C901 /* Main.storyboard */; }; + 04C6EABE2EAF86530089C901 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAAD2EAF86530089C901 /* AppDelegate.m */; }; + 04C6EABF2EAF86530089C901 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAB22EAF86530089C901 /* main.m */; }; + 04C6EAC12EAF86530089C901 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAB82EAF86530089C901 /* ViewController.m */; }; + 04C6EACE2EAF87020089C901 /* CustomKeyboard.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 04C6EAC62EAF87020089C901 /* CustomKeyboard.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 04C6EAD82EAF870B0089C901 /* KeyboardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAD62EAF870B0089C901 /* KeyboardViewController.m */; }; + 04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 04C6EACC2EAF87020089C901 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 727EC74B2EAF848B00B36487 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 04C6EAC52EAF87020089C901; + remoteInfo = CustomKeyboard; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 04C6EAD32EAF87020089C901 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 04C6EACE2EAF87020089C901 /* CustomKeyboard.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ + 04C6EAAC2EAF86530089C901 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 04C6EAAD2EAF86530089C901 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 04C6EAAE2EAF86530089C901 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 04C6EAAF2EAF86530089C901 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 04C6EAB02EAF86530089C901 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 04C6EAB22EAF86530089C901 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 04C6EAB32EAF86530089C901 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 04C6EAB72EAF86530089C901 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 04C6EAB82EAF86530089C901 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 04C6EAC62EAF87020089C901 /* CustomKeyboard.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = CustomKeyboard.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 04C6EAD42EAF870B0089C901 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 04C6EAD52EAF870B0089C901 /* KeyboardViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardViewController.h; sourceTree = ""; }; + 04C6EAD62EAF870B0089C901 /* KeyboardViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardViewController.m; sourceTree = ""; }; + 04C6EADB2EAF8CEB0089C901 /* KBToolBar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBToolBar.h; sourceTree = ""; }; + 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBToolBar.m; sourceTree = ""; }; + 04C6EADE2EAF8D680089C901 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; 727EC7532EAF848B00B36487 /* keyBoard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = keyBoard.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 727EC76A2EAF848C00B36487 /* Exceptions for "keyBoard" folder in "keyBoard" target */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - Info.plist, - ); - target = 727EC7522EAF848B00B36487 /* keyBoard */; - }; -/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - 727EC7552EAF848B00B36487 /* keyBoard */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - 727EC76A2EAF848C00B36487 /* Exceptions for "keyBoard" folder in "keyBoard" target */, - ); - path = keyBoard; - sourceTree = ""; - }; -/* End PBXFileSystemSynchronizedRootGroup section */ - /* Begin PBXFrameworksBuildPhase section */ + 04C6EAC32EAF87020089C901 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 727EC7502EAF848B00B36487 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -42,10 +80,48 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 04C6EAB92EAF86530089C901 /* keyBoard */ = { + isa = PBXGroup; + children = ( + 04C6EAAC2EAF86530089C901 /* AppDelegate.h */, + 04C6EAAD2EAF86530089C901 /* AppDelegate.m */, + 04C6EAAE2EAF86530089C901 /* Assets.xcassets */, + 04C6EAAF2EAF86530089C901 /* Info.plist */, + 04C6EAB12EAF86530089C901 /* LaunchScreen.storyboard */, + 04C6EAB22EAF86530089C901 /* main.m */, + 04C6EAB42EAF86530089C901 /* Main.storyboard */, + 04C6EAB72EAF86530089C901 /* ViewController.h */, + 04C6EAB82EAF86530089C901 /* ViewController.m */, + ); + path = keyBoard; + sourceTree = ""; + }; + 04C6EAD72EAF870B0089C901 /* CustomKeyboard */ = { + isa = PBXGroup; + children = ( + 04C6EADA2EAF8C7B0089C901 /* View */, + 04C6EAD42EAF870B0089C901 /* Info.plist */, + 04C6EAD52EAF870B0089C901 /* KeyboardViewController.h */, + 04C6EAD62EAF870B0089C901 /* KeyboardViewController.m */, + 04C6EADE2EAF8D680089C901 /* PrefixHeader.pch */, + ); + path = CustomKeyboard; + sourceTree = ""; + }; + 04C6EADA2EAF8C7B0089C901 /* View */ = { + isa = PBXGroup; + children = ( + 04C6EADB2EAF8CEB0089C901 /* KBToolBar.h */, + 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */, + ); + path = View; + sourceTree = ""; + }; 727EC74A2EAF848B00B36487 = { isa = PBXGroup; children = ( - 727EC7552EAF848B00B36487 /* keyBoard */, + 04C6EAB92EAF86530089C901 /* keyBoard */, + 04C6EAD72EAF870B0089C901 /* CustomKeyboard */, 727EC7542EAF848B00B36487 /* Products */, ); sourceTree = ""; @@ -54,6 +130,7 @@ isa = PBXGroup; children = ( 727EC7532EAF848B00B36487 /* keyBoard.app */, + 04C6EAC62EAF87020089C901 /* CustomKeyboard.appex */, ); name = Products; sourceTree = ""; @@ -61,6 +138,25 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 04C6EAC52EAF87020089C901 /* CustomKeyboard */ = { + isa = PBXNativeTarget; + buildConfigurationList = 04C6EAD02EAF87020089C901 /* Build configuration list for PBXNativeTarget "CustomKeyboard" */; + buildPhases = ( + 04C6EAC22EAF87020089C901 /* Sources */, + 04C6EAC32EAF87020089C901 /* Frameworks */, + 04C6EAC42EAF87020089C901 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CustomKeyboard; + packageProductDependencies = ( + ); + productName = CustomKeyboard; + productReference = 04C6EAC62EAF87020089C901 /* CustomKeyboard.appex */; + productType = "com.apple.product-type.app-extension"; + }; 727EC7522EAF848B00B36487 /* keyBoard */ = { isa = PBXNativeTarget; buildConfigurationList = 727EC76B2EAF848C00B36487 /* Build configuration list for PBXNativeTarget "keyBoard" */; @@ -68,13 +164,12 @@ 727EC74F2EAF848B00B36487 /* Sources */, 727EC7502EAF848B00B36487 /* Frameworks */, 727EC7512EAF848B00B36487 /* Resources */, + 04C6EAD32EAF87020089C901 /* Embed Foundation Extensions */, ); buildRules = ( ); dependencies = ( - ); - fileSystemSynchronizedGroups = ( - 727EC7552EAF848B00B36487 /* keyBoard */, + 04C6EACD2EAF87020089C901 /* PBXTargetDependency */, ); name = keyBoard; packageProductDependencies = ( @@ -90,8 +185,12 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; + CLASSPREFIX = KB; LastUpgradeCheck = 2600; TargetAttributes = { + 04C6EAC52EAF87020089C901 = { + CreatedOnToolsVersion = 16.4; + }; 727EC7522EAF848B00B36487 = { CreatedOnToolsVersion = 26.0.1; }; @@ -112,31 +211,133 @@ projectRoot = ""; targets = ( 727EC7522EAF848B00B36487 /* keyBoard */, + 04C6EAC52EAF87020089C901 /* CustomKeyboard */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 727EC7512EAF848B00B36487 /* Resources */ = { + 04C6EAC42EAF87020089C901 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; + 727EC7512EAF848B00B36487 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 04C6EABA2EAF86530089C901 /* Assets.xcassets in Resources */, + 04C6EABC2EAF86530089C901 /* LaunchScreen.storyboard in Resources */, + 04C6EABD2EAF86530089C901 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 04C6EAC22EAF87020089C901 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */, + 04C6EAD82EAF870B0089C901 /* KeyboardViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 727EC74F2EAF848B00B36487 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 04C6EABE2EAF86530089C901 /* AppDelegate.m in Sources */, + 04C6EABF2EAF86530089C901 /* main.m in Sources */, + 04C6EAC12EAF86530089C901 /* ViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 04C6EACD2EAF87020089C901 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 04C6EAC52EAF87020089C901 /* CustomKeyboard */; + targetProxy = 04C6EACC2EAF87020089C901 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 04C6EAB12EAF86530089C901 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 04C6EAB02EAF86530089C901 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + 04C6EAB42EAF86530089C901 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 04C6EAB32EAF86530089C901 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ + 04C6EAD12EAF87020089C901 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = TN6HHV45BB; + GCC_PREFIX_HEADER = CustomKeyboard/PrefixHeader.pch; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = CustomKeyboard/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "卡拉斯输入法"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.keyBoard.CustomKeyboard; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 04C6EAD22EAF87020089C901 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = TN6HHV45BB; + GCC_PREFIX_HEADER = CustomKeyboard/PrefixHeader.pch; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = CustomKeyboard/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "卡拉斯输入法"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.keyBoard.CustomKeyboard; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 727EC76C2EAF848C00B36487 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -144,20 +345,22 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = CBD35U2N52; + DEVELOPMENT_TEAM = TN6HHV45BB; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = keyBoard/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "卡拉斯输入法"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "-.keyBoard"; + PRODUCT_BUNDLE_IDENTIFIER = com.keyBoard; PRODUCT_NAME = "$(TARGET_NAME)"; STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -172,20 +375,22 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = CBD35U2N52; + DEVELOPMENT_TEAM = TN6HHV45BB; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = keyBoard/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "卡拉斯输入法"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "-.keyBoard"; + PRODUCT_BUNDLE_IDENTIFIER = com.keyBoard; PRODUCT_NAME = "$(TARGET_NAME)"; STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -314,6 +519,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 04C6EAD02EAF87020089C901 /* Build configuration list for PBXNativeTarget "CustomKeyboard" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 04C6EAD12EAF87020089C901 /* Debug */, + 04C6EAD22EAF87020089C901 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 727EC74E2EAF848B00B36487 /* Build configuration list for PBXProject "keyBoard" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/keyBoard/AppDelegate.h b/keyBoard/AppDelegate.h index ee8d79d..88aaeef 100644 --- a/keyBoard/AppDelegate.h +++ b/keyBoard/AppDelegate.h @@ -9,6 +9,7 @@ @interface AppDelegate : UIResponder +@property (nonatomic, strong) UIWindow *window; @end diff --git a/keyBoard/AppDelegate.m b/keyBoard/AppDelegate.m index a3f34ca..9e49607 100644 --- a/keyBoard/AppDelegate.m +++ b/keyBoard/AppDelegate.m @@ -6,6 +6,7 @@ // #import "AppDelegate.h" +#import "ViewController.h" @interface AppDelegate () @@ -16,25 +17,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.window.backgroundColor = [UIColor whiteColor]; + [self.window makeKeyAndVisible]; + ViewController *vc = [[ViewController alloc] init]; + self.window.rootViewController = vc; return YES; } - -#pragma mark - UISceneSession lifecycle - - -- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. - return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; -} - - -- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. -} - - @end diff --git a/keyBoard/Info.plist b/keyBoard/Info.plist index 81ed29b..0c67376 100644 --- a/keyBoard/Info.plist +++ b/keyBoard/Info.plist @@ -1,25 +1,5 @@ - - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - UISceneConfigurations - - UIWindowSceneSessionRoleApplication - - - UISceneConfigurationName - Default Configuration - UISceneDelegateClassName - SceneDelegate - UISceneStoryboardFile - Main - - - - - + diff --git a/keyBoard/SceneDelegate.h b/keyBoard/SceneDelegate.h deleted file mode 100644 index 805135e..0000000 --- a/keyBoard/SceneDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SceneDelegate.h -// keyBoard -// -// Created by 张伟 on 2025/10/27. -// - -#import - -@interface SceneDelegate : UIResponder - -@property (strong, nonatomic) UIWindow * window; - -@end - diff --git a/keyBoard/SceneDelegate.m b/keyBoard/SceneDelegate.m deleted file mode 100644 index 3eb32b8..0000000 --- a/keyBoard/SceneDelegate.m +++ /dev/null @@ -1,57 +0,0 @@ -// -// SceneDelegate.m -// keyBoard -// -// Created by 张伟 on 2025/10/27. -// - -#import "SceneDelegate.h" - -@interface SceneDelegate () - -@end - -@implementation SceneDelegate - - -- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). -} - - -- (void)sceneDidDisconnect:(UIScene *)scene { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). -} - - -- (void)sceneDidBecomeActive:(UIScene *)scene { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. -} - - -- (void)sceneWillResignActive:(UIScene *)scene { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). -} - - -- (void)sceneWillEnterForeground:(UIScene *)scene { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. -} - - -- (void)sceneDidEnterBackground:(UIScene *)scene { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. -} - - -@end diff --git a/keyBoard/ViewController.m b/keyBoard/ViewController.m index 0fd6e90..531aba0 100644 --- a/keyBoard/ViewController.m +++ b/keyBoard/ViewController.m @@ -8,7 +8,7 @@ #import "ViewController.h" @interface ViewController () - +@property (nonatomic,strong)UITextField *textField; @end @implementation ViewController @@ -16,6 +16,14 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. + self.view.backgroundColor = [UIColor grayColor]; + self.textField = [[UITextField alloc] init]; + self.textField.frame = CGRectMake(100, 100, 200, 40); + self.textField.layer.borderWidth = 1; + self.textField.layer.borderColor = [UIColor redColor].CGColor; + [self.view addSubview:self.textField]; + + }