添加基本页面
This commit is contained in:
@@ -29,6 +29,8 @@
|
|||||||
04FC95CC2EB1E780007BD342 /* BaseTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95CB2EB1E780007BD342 /* BaseTabBarController.m */; };
|
04FC95CC2EB1E780007BD342 /* BaseTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95CB2EB1E780007BD342 /* BaseTabBarController.m */; };
|
||||||
04FC95CF2EB1E7A1007BD342 /* HomeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95CE2EB1E7A1007BD342 /* HomeVC.m */; };
|
04FC95CF2EB1E7A1007BD342 /* HomeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95CE2EB1E7A1007BD342 /* HomeVC.m */; };
|
||||||
04FC95D22EB1E7AE007BD342 /* MyVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95D12EB1E7AE007BD342 /* MyVC.m */; };
|
04FC95D22EB1E7AE007BD342 /* MyVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95D12EB1E7AE007BD342 /* MyVC.m */; };
|
||||||
|
04FC95D72EB1EA16007BD342 /* BaseTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95D62EB1EA16007BD342 /* BaseTableView.m */; };
|
||||||
|
04FC95D82EB1EA16007BD342 /* BaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95D42EB1EA16007BD342 /* BaseCell.m */; };
|
||||||
7A36414DFDA5BEC9B7D2E318 /* Pods_CustomKeyboard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */; };
|
7A36414DFDA5BEC9B7D2E318 /* Pods_CustomKeyboard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */; };
|
||||||
A1B2C3D42EB0A0A100000001 /* KBFunctionTagCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D32EB0A0A100000001 /* KBFunctionTagCell.m */; };
|
A1B2C3D42EB0A0A100000001 /* KBFunctionTagCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D32EB0A0A100000001 /* KBFunctionTagCell.m */; };
|
||||||
A1B2C3E22EB0C0A100000001 /* KBNetworkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3E12EB0C0A100000001 /* KBNetworkManager.m */; };
|
A1B2C3E22EB0C0A100000001 /* KBNetworkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3E12EB0C0A100000001 /* KBNetworkManager.m */; };
|
||||||
@@ -103,6 +105,10 @@
|
|||||||
04FC95CE2EB1E7A1007BD342 /* HomeVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeVC.m; sourceTree = "<group>"; };
|
04FC95CE2EB1E7A1007BD342 /* HomeVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeVC.m; sourceTree = "<group>"; };
|
||||||
04FC95D02EB1E7AE007BD342 /* MyVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyVC.h; sourceTree = "<group>"; };
|
04FC95D02EB1E7AE007BD342 /* MyVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyVC.h; sourceTree = "<group>"; };
|
||||||
04FC95D12EB1E7AE007BD342 /* MyVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyVC.m; sourceTree = "<group>"; };
|
04FC95D12EB1E7AE007BD342 /* MyVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyVC.m; sourceTree = "<group>"; };
|
||||||
|
04FC95D32EB1EA16007BD342 /* BaseCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseCell.h; sourceTree = "<group>"; };
|
||||||
|
04FC95D42EB1EA16007BD342 /* BaseCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseCell.m; sourceTree = "<group>"; };
|
||||||
|
04FC95D52EB1EA16007BD342 /* BaseTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseTableView.h; sourceTree = "<group>"; };
|
||||||
|
04FC95D62EB1EA16007BD342 /* BaseTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseTableView.m; sourceTree = "<group>"; };
|
||||||
2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CustomKeyboard.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CustomKeyboard.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
51FE7C4C42C2255B3C1C4128 /* Pods-keyBoard.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-keyBoard.release.xcconfig"; path = "Target Support Files/Pods-keyBoard/Pods-keyBoard.release.xcconfig"; sourceTree = "<group>"; };
|
51FE7C4C42C2255B3C1C4128 /* Pods-keyBoard.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-keyBoard.release.xcconfig"; path = "Target Support Files/Pods-keyBoard/Pods-keyBoard.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
727EC7532EAF848B00B36487 /* keyBoard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = keyBoard.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
727EC7532EAF848B00B36487 /* keyBoard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = keyBoard.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -332,6 +338,10 @@
|
|||||||
04FC95C42EB1E4AB007BD342 /* V */ = {
|
04FC95C42EB1E4AB007BD342 /* V */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
04FC95D32EB1EA16007BD342 /* BaseCell.h */,
|
||||||
|
04FC95D42EB1EA16007BD342 /* BaseCell.m */,
|
||||||
|
04FC95D52EB1EA16007BD342 /* BaseTableView.h */,
|
||||||
|
04FC95D62EB1EA16007BD342 /* BaseTableView.m */,
|
||||||
);
|
);
|
||||||
path = V;
|
path = V;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -599,6 +609,8 @@
|
|||||||
04FC95D22EB1E7AE007BD342 /* MyVC.m in Sources */,
|
04FC95D22EB1E7AE007BD342 /* MyVC.m in Sources */,
|
||||||
043FBCD22EAF97630036AFE1 /* KBPermissionViewController.m in Sources */,
|
043FBCD22EAF97630036AFE1 /* KBPermissionViewController.m in Sources */,
|
||||||
04C6EABE2EAF86530089C901 /* AppDelegate.m in Sources */,
|
04C6EABE2EAF86530089C901 /* AppDelegate.m in Sources */,
|
||||||
|
04FC95D72EB1EA16007BD342 /* BaseTableView.m in Sources */,
|
||||||
|
04FC95D82EB1EA16007BD342 /* BaseCell.m in Sources */,
|
||||||
04FC95C92EB1E4C9007BD342 /* BaseNavigationController.m in Sources */,
|
04FC95C92EB1E4C9007BD342 /* BaseNavigationController.m in Sources */,
|
||||||
04FC95CF2EB1E7A1007BD342 /* HomeVC.m in Sources */,
|
04FC95CF2EB1E7A1007BD342 /* HomeVC.m in Sources */,
|
||||||
04C6EABF2EAF86530089C901 /* main.m in Sources */,
|
04C6EABF2EAF86530089C901 /* main.m in Sources */,
|
||||||
|
|||||||
23
keyBoard/Class/Base/V/BaseCell.h
Normal file
23
keyBoard/Class/Base/V/BaseCell.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// BaseCell.h
|
||||||
|
// keyBoard
|
||||||
|
//
|
||||||
|
// Common base cell with default selection style and hook for setup.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface BaseCell : UITableViewCell
|
||||||
|
|
||||||
|
/// Convenience reuse identifier based on class name
|
||||||
|
+ (NSString *)reuseId;
|
||||||
|
|
||||||
|
/// Override point to add subviews and constraints
|
||||||
|
- (void)setupUI;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
32
keyBoard/Class/Base/V/BaseCell.m
Normal file
32
keyBoard/Class/Base/V/BaseCell.m
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// BaseCell.m
|
||||||
|
// keyBoard
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BaseCell.h"
|
||||||
|
|
||||||
|
@implementation BaseCell
|
||||||
|
|
||||||
|
+ (NSString *)reuseId {
|
||||||
|
return NSStringFromClass(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||||
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||||
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||||
|
[self setupUI];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)prepareForReuse {
|
||||||
|
[super prepareForReuse];
|
||||||
|
// Reset state if needed by subclasses
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setupUI {
|
||||||
|
// Subclasses override to build UI
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
17
keyBoard/Class/Base/V/BaseTableView.h
Normal file
17
keyBoard/Class/Base/V/BaseTableView.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// BaseTableView.h
|
||||||
|
// keyBoard
|
||||||
|
//
|
||||||
|
// A lightweight UITableView subclass for common defaults.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface BaseTableView : UITableView
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
||||||
30
keyBoard/Class/Base/V/BaseTableView.m
Normal file
30
keyBoard/Class/Base/V/BaseTableView.m
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// BaseTableView.m
|
||||||
|
// keyBoard
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BaseTableView.h"
|
||||||
|
|
||||||
|
@implementation BaseTableView
|
||||||
|
|
||||||
|
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
|
||||||
|
if (self = [super initWithFrame:frame style:style]) {
|
||||||
|
[self commonInit];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)commonInit {
|
||||||
|
self.sectionHeaderTopPadding = 0;
|
||||||
|
self.backgroundColor = [UIColor whiteColor];
|
||||||
|
self.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
|
||||||
|
// Disable estimates to avoid jumpy updates for simple lists; tweak per-screen if needed
|
||||||
|
self.estimatedRowHeight = 0;
|
||||||
|
self.estimatedSectionHeaderHeight = 0;
|
||||||
|
self.estimatedSectionFooterHeight = 0;
|
||||||
|
self.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@@ -15,7 +15,16 @@
|
|||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view.
|
self.view.backgroundColor = [UIColor whiteColor];
|
||||||
|
// Simple demo content so the tab is distinguishable
|
||||||
|
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||||
|
label.text = @"Home";
|
||||||
|
label.textColor = [UIColor darkTextColor];
|
||||||
|
label.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||||
|
[label sizeToFit];
|
||||||
|
label.center = self.view.center;
|
||||||
|
label.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||||
|
[self.view addSubview:label];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#import "BaseTabBarController.h"
|
#import "BaseTabBarController.h"
|
||||||
#import "HomeVC.h"
|
#import "HomeVC.h"
|
||||||
#import "MyVC.h"
|
#import "MyVC.h"
|
||||||
|
#import "BaseNavigationController.h"
|
||||||
|
|
||||||
@interface BaseTabBarController ()
|
@interface BaseTabBarController ()
|
||||||
|
|
||||||
@@ -17,7 +18,18 @@
|
|||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
// Setup two tabs: Home & My, each embedded in BaseNavigationController
|
||||||
|
HomeVC *home = [[HomeVC alloc] init];
|
||||||
|
home.title = @"首页";
|
||||||
|
BaseNavigationController *navHome = [[BaseNavigationController alloc] initWithRootViewController:home];
|
||||||
|
navHome.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:nil selectedImage:nil];
|
||||||
|
|
||||||
|
MyVC *my = [[MyVC alloc] init];
|
||||||
|
my.title = @"我的";
|
||||||
|
BaseNavigationController *navMy = [[BaseNavigationController alloc] initWithRootViewController:my];
|
||||||
|
navMy.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:nil selectedImage:nil];
|
||||||
|
|
||||||
|
self.viewControllers = @[navHome, navMy];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -15,7 +15,15 @@
|
|||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view.
|
self.view.backgroundColor = [UIColor whiteColor];
|
||||||
|
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||||
|
label.text = @"My";
|
||||||
|
label.textColor = [UIColor darkTextColor];
|
||||||
|
label.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||||
|
[label sizeToFit];
|
||||||
|
label.center = self.view.center;
|
||||||
|
label.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||||
|
[self.view addSubview:label];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user