添加基本页面
This commit is contained in:
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
|
||||
|
||||
Reference in New Issue
Block a user