第三十三篇:私人通迅录(有存储功能)

2024-05-12 20:08

本文主要是介绍第三十三篇:私人通迅录(有存储功能),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

用了第三方框架:MBProgressHUD


Main.storyboard:


Model

//
//  QJContact.h
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import <Foundation/Foundation.h>@interface QJContact : NSObject<NSCoding>@property (nonatomic , copy) NSString * name;
@property (nonatomic , copy) NSString * phoneNumber;+ (instancetype)contact;@end
//
//  QJContact.m
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import "QJContact.h"@implementation QJContact+ (instancetype)contact{return [[self alloc] init];
}// 归档(编码)
- (void)encodeWithCoder:(NSCoder *)aCoder{[aCoder encodeObject:self.name forKey:@"name"];[aCoder encodeObject:self.phoneNumber forKey:@"phoneNumber"];
}//恢复(解码)- (instancetype)initWithCoder:(NSCoder *)aDecoder{self.name = [aDecoder decodeObjectForKey:@"name"];self.phoneNumber = [aDecoder decodeObjectForKey:@"phoneNumber"];return self;
}@end

View

//
//  QJContactCell.h
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class QJContact;
@interface QJContactCell : UITableViewCell@property (nonatomic , strong)QJContact * contact;+ (instancetype)contactCellWithTableView:(UITableView *)tabelView;@end
//
//  QJContactCell.m
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import "QJContactCell.h"
#import "QJContact.h"@interface QJContactCell ()@property (nonatomic , weak)UIView * speradLine;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneNumberLabel;@end@implementation QJContactCell+ (instancetype)contactCellWithTableView:(UITableView *)tabelView{static NSString * ID = @"contact";/***  先从缓存中跟据"contact"标识找可用的cell;如果没有再从storyboard/xib中找*/return [tabelView dequeueReusableCellWithIdentifier:ID];
}- (void)setContact:(QJContact *)contact{_contact = contact ;self.nameLabel.text = contact.name;self.phoneNumberLabel.text = contact.phoneNumber;
}
/***  当cell从storyboard/xib中创建出cell后立刻调用该方法*/
- (void)awakeFromNib{
//    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;UIView * speradLine = [[UIView alloc]init];speradLine.backgroundColor = [UIColor grayColor];speradLine.alpha = 0.7;[self.contentView addSubview:speradLine];self.speradLine = speradLine;}- (void)layoutSubviews{
//    NSLog(@"---layoutSubviews--");CGFloat X = 0;CGFloat W = self.frame.size.width;CGFloat H = 1;CGFloat Y = self.frame.size.height - H;self.speradLine.frame = CGRectMake(X, Y, W, H);}@end

Contorller

登陆页面:




//
//  QJLoginViewController.h
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import <UIKit/UIKit.h>@interface QJLoginViewController : UIViewController@end
//
//  QJLoginViewController.m
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import "QJLoginViewController.h"
#import "QJContactViewController.h"
#import "MBProgressHUD+MJ.h"#define QJKeyUserName           @"userName"
#define QJKeyPassword           @"password"
#define QJKeyRemeberPassword    @"remeberPassword"
#define QJKeyAutoLogin          @"autoLogin"@interface QJLoginViewController ()@property (weak, nonatomic) IBOutlet UITextField *userNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextField;
@property (weak, nonatomic) IBOutlet UISwitch *remeberPasswordSwith;
@property (weak, nonatomic) IBOutlet UISwitch *autoLoginSwitch;@property (weak, nonatomic) IBOutlet UIButton *loginBtn;
@property (weak, nonatomic) IBOutlet UIView *activityView;- (void)customNavigationItem;
- (IBAction)login;
- (void)changeUserNameTextField;
- (void)changePasswordTextField;
- (IBAction)remeberPassword;
- (IBAction)autoLogin;@end@implementation QJLoginViewController- (void)viewDidLoad {[super viewDidLoad];// 创建并设置navigationItem的backBarButtonItem[self customNavigationItem];
//    NSLog(@"%@",NSHomeDirectory()); // 添加消息通知[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeUserNameTextField) name:UITextFieldTextDidChangeNotification object:self.userNameTextField];[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePasswordTextField) name:UITextFieldTextDidChangeNotification object:self.passwordTextField];// 读取配置[self readConfiguratStat];}
- (void)viewDidAppear:(BOOL)animated{[super viewDidAppear:animated];static BOOL isAuto = NO;if (isAuto == NO) {isAuto = YES ;if(self.autoLoginSwitch.on && self.userNameTextField.text.length && self.passwordTextField.text.length ){[self login];}}
}- (void)dealloc{[[NSNotificationCenter defaultCenter] removeObserver:self];
}- (void)readConfiguratStat{NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];self.userNameTextField.text = [defaults objectForKey:QJKeyUserName];self.remeberPasswordSwith.on = [defaults boolForKey:QJKeyRemeberPassword];if (self.remeberPasswordSwith.on) {self.passwordTextField.text = [defaults objectForKey:QJKeyPassword];}self.autoLoginSwitch.on = [defaults boolForKey:QJKeyAutoLogin];
}
- (void)saveConfiguratStat{NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];[defaults setObject:self.userNameTextField.text forKey:QJKeyUserName];[defaults setObject:self.passwordTextField.text forKey:QJKeyPassword];[defaults setBool:self.remeberPasswordSwith.isOn forKey:QJKeyRemeberPassword];[defaults setBool:self.autoLoginSwitch.isOn forKey:QJKeyAutoLogin];}/** 创建并设置navigationItem的backBarButtonItem */
- (void)customNavigationItem
{UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:nil action:nil];self.navigationItem.backBarButtonItem = item;
}/** 监听userNameTextField的text内容改变,只要改变就会调用 */
- (void)changeUserNameTextField{if (self.userNameTextField.text) {self.loginBtn.enabled = (self.userNameTextField.text.length && self.passwordTextField.text.length );}
}/** 监听passwordTextField的text内容改变,只要改变就会调用 */
- (void)changePasswordTextField{if (self.passwordTextField.text) {self.loginBtn.enabled = (self.userNameTextField.text.length && self.passwordTextField.text.length );}
}- (IBAction)remeberPassword {[self.autoLoginSwitch setOn:self.remeberPasswordSwith.on animated:YES];
}- (IBAction)autoLogin {[self.remeberPasswordSwith setOn:self.autoLoginSwitch.on animated:YES];
}/** 响应loginBtn点击 */
- (IBAction)login {[self.view endEditing:YES];
//    UIAlertView * alertView = [UIAlertView alloc];if (![self.userNameTextField.text isEqualToString:@"QJ"]) { // 账号:QJ
//        [alertView initWithTitle:nil message:@"你输入的账号不存在" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//        [alertView show];[MBProgressHUD showError:@"你输入的账号不存在"];return ;}if ( ![self.passwordTextField.text isEqualToString:@"123"]) { // 密码:123
//        [alertView initWithTitle:nil message:@"你输入的密码错误" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//        [alertView show];[MBProgressHUD showError:@"你输入的密码错误"];return ;}[MBProgressHUD showMessage:@"正在加载,稍等..."];// 存储配置[self saveConfiguratStat];
//    self.activityView.hidden = NO;dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{[MBProgressHUD hideHUD];
//        self.activityView.hidden = YES;[self performSegueWithIdentifier:@"login" sender:nil];});}/** 当UISegue对象初始化完后,在跳转到下一个挖人制器之前,系统自动调用 */
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{QJContactViewController * distVC = segue.destinationViewController;distVC.title = [NSString stringWithFormat:@"%@的通迅录",self.userNameTextField.text];}@end


通迅录页面:



//
//  QJContactViewController.h
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import <UIKit/UIKit.h>@interface QJContactViewController : UITableViewController@end
//
//  QJContactViewController.m
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import "QJContactViewController.h"
#import "QJContact.h"
#import "QJAddContactViewController.h"
#import "QJContactCell.h"
#import "QJEditViewController.h"// 数据存储的绝对路径
#define QJContactFilepath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"contactList.data"]@interface QJContactViewController ()<UIActionSheetDelegate,QJAddContactViewControllerDelegate,QJEditViewControllerDelegate>@property (nonatomic , strong)NSMutableArray * contactList;- (IBAction)logout;@end@implementation QJContactViewController- (void)viewDidLoad {[super viewDidLoad];UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithTitle:@"反回" style:UIBarButtonItemStyleDone target:nil action:nil];self.navigationItem.backBarButtonItem = item;// 设置分隔线的样式self.tableView.separatorStyle = UITableViewCellAccessoryNone;// 取一个数据
//        NSArray * array = ;
//        NSString * document = [array lastObject];
//        NSString * filePath = [document stringByAppendingPathComponent:@"contactList.plist"];
//    NSLog(@"%@",filePath);
//    NSString * docuent = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
//    NSString * filePath = [docuent stringByAppendingPathComponent:@"contactList.plist"];// 从filePath中取QJContact对象//NSString * filePath = (NSString *)QJContactFilePath;}
//- (void)viewWillAppear:(BOOL)animated{
//    
//    
//    NSLog(@"%@",contact);
//}- (NSMutableArray *)contactList{if (_contactList == nil) {// 取数据,需要时加载_contactList = [NSKeyedUnarchiver unarchiveObjectWithFile:QJContactFilepath];if (nil == _contactList) {_contactList = [NSMutableArray array];}}return _contactList;
}#pragma mark - tableViewDataSource协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{return self.contactList.count ;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{// 创建一个cellQJContactCell * cell = [QJContactCell contactCellWithTableView:tableView];// 设置cell数据内容QJContact * contact = self.contactList[indexPath.row];cell.contact = contact;
//    NSLog(@"---cellForRowAtIndexPath---");return cell;}#pragma mark - tableViewDelegate协议方法
/***  当cell向左滑动后,点击了“删除”或其他按妞时做一些事情*/
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{if (UITableViewCellEditingStyleDelete == editingStyle) { // 删除类型// 删除一行[self.contactList removeObjectAtIndex:indexPath.row];[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];// 数据归档[NSKeyedArchiver archiveRootObject:self.contactList toFile:QJContactFilepath];}
}
//-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//    NSLog(@"选中一行--------");
//    QJAddContactViewController * addCVC = [[QJAddContactViewController alloc]init];
//    addCVC.view.backgroundColor = [UIColor whiteColor];
//    // 设置navigationItem
//    addCVC.navigationItem.title = @"查看联系人";
//    UIBarButtonItem * edit = [[UIBarButtonItem alloc]initWithTitle:@"编辑" style:(UIBarButtonItemStyleDone) target:nil action:nil];
//    addCVC.navigationItem.rightBarButtonItems = @[edit];
//    
//    [self.navigationController pushViewController:addCVC animated:YES];
//}- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{id destVC = segue.destinationViewController;if ([destVC isKindOfClass:[QJAddContactViewController class]]) {QJAddContactViewController * addCVC = destVC;addCVC.delegate = self;}else if([destVC isKindOfClass:[QJEditViewController class]]){NSIndexPath * indexPath = [self.tableView indexPathForSelectedRow];QJContact * contact = self.contactList[indexPath.row];QJEditViewController * editVC =  destVC;editVC.contact = contact ;editVC.delegate = self;}
}/** 点击注消,响应事件 */
- (IBAction)logout {UIActionSheet * sheet = [[UIActionSheet alloc]initWithTitle:@"是否确定要注消" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:nil, nil];// 从底部升出一个弹窗[sheet showInView:self.view];}
#pragma mark - UIActionSheet代理方法
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{if (buttonIndex == 0) {[self.navigationController popViewControllerAnimated:YES];}
}#pragma mark - QJAddContactViewControllerDelegate- (void)addContactViewController:(QJAddContactViewController *)addCVC didClickAddBtnWithQJContact:(QJContact *)contact{[self.contactList addObject:contact];[self.tableView reloadData];// 数据归档[NSKeyedArchiver archiveRootObject:self.contactList toFile:QJContactFilepath];
}#pragma mark - QJEditViewControllerDelegate- (void)editViewController:(QJEditViewController *)editVC didSaveWithContact:(QJContact *)contact{// 这里不用设置修改的contact,原因是:当时从当前控制器的某个contatct传到下一个QJEditViewController控制器的contact,地址是一样的,所以当QJEditViewController控制器的contact被修改了,当前控制器传入的contact也会修改。所以在这个方法体内不必理会当前传入的contact// 数据归档[NSKeyedArchiver archiveRootObject:self.contactList toFile:QJContactFilepath];[self.tableView reloadData];
}@end


添加联系人页面:

//
//  QJAddContactViewController.h
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import <UIKit/UIKit.h>@class QJContact,QJAddContactViewController;@protocol QJAddContactViewControllerDelegate <NSObject>- (void)addContactViewController:(QJAddContactViewController *) addCVC didClickAddBtnWithQJContact:(QJContact *)contact;@end@interface QJAddContactViewController : UIViewController@property (nonatomic , weak)id<QJAddContactViewControllerDelegate> delegate;@end
//
//  QJAddContactViewController.m
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import "QJAddContactViewController.h"
#import "QJContact.h"@interface QJAddContactViewController ()
@property (weak, nonatomic) IBOutlet UITextField *nameTextField;
@property (weak, nonatomic) IBOutlet UITextField *phoneNumber;
@property (weak, nonatomic) IBOutlet UIButton *addBtn;- (void)changeTextField;
- (void)addContact;@end@implementation QJAddContactViewController- (void)viewDidLoad {[super viewDidLoad];
//    self.title = @"添加联系人";self.navigationItem.title = @"添加联系人";// 成为第一响应[self.nameTextField becomeFirstResponder ];// 添加UITextFieldTextDidChangeNotification通知[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTextField) name:UITextFieldTextDidChangeNotification object:self.nameTextField];[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTextField) name:UITextFieldTextDidChangeNotification object:self.phoneNumber];// 添加addBtn按妞监听[self.addBtn addTarget:self action:@selector(addContact) forControlEvents:UIControlEventTouchUpInside];}
- (void)dealloc{// 有监听就要移除[[NSNotificationCenter defaultCenter] removeObserver:self];
}- (void)changeTextField{self.addBtn.enabled = (self.nameTextField.text.length > 0 && self.phoneNumber.text.length > 0);
}- (void)addContact{QJContact * contact = [QJContact contact];contact.name = self.nameTextField.text;contact.phoneNumber = self.phoneNumber.text;//if ([self.delegate respondsToSelector:@selector(addContactViewController:didClickAddBtnWithQJContact:)]) {[self.delegate addContactViewController:self didClickAddBtnWithQJContact:contact];}[self.navigationController popViewControllerAnimated:YES];
}@end


查看修改联系人页面:



//
//  QJEditViewController.h
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import <UIKit/UIKit.h>
@class QJContact,QJEditViewController;@protocol QJEditViewControllerDelegate <NSObject>- (void)editViewController:(QJEditViewController *)editVC didSaveWithContact:(QJContact *)contact;@end@interface QJEditViewController : UIViewController@property (nonatomic , strong)QJContact * contact;
@property (nonatomic , weak)id<QJEditViewControllerDelegate> delegate;@end
//
//  QJEditViewController.m
//  13-私人通迅录
//
//  Created by 瞿杰 on 15/10/9.
//  Copyright © 2015年 itcast. All rights reserved.
//#import "QJEditViewController.h"
#import "QJContact.h"
@interface QJEditViewController ()
@property (weak, nonatomic) IBOutlet UITextField *nameTextField;
@property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextField;
@property (weak, nonatomic) IBOutlet UIButton *saveBtn;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *editBtn;- (IBAction)editBtnDidClicked:(id)sender;
- (void)save:(UIButton *)btn;
- (void)changeTextFieldContents;
@end@implementation QJEditViewController- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.// 填数据self.nameTextField.text = self.contact.name;self.phoneNumberTextField.text = self.contact.phoneNumber;self.nameTextField.enabled = NO;self.phoneNumberTextField.enabled = NO;self.saveBtn.enabled = YES;self.saveBtn.hidden = YES;// 添加监听点击事件[self.saveBtn addTarget:self action:@selector(save:) forControlEvents:(UIControlEventTouchUpInside)];// 添加消息监听[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTextFieldContents) name:UITextFieldTextDidChangeNotification object:nil];}- (void)dealloc{
//    NSLog(@"----dealloc---");[[NSNotificationCenter defaultCenter] removeObserver:self];
}
/***  时时监听textField内容的改变,以改变saveBtn能否交互状态*/
- (void)changeTextFieldContents{self.saveBtn.enabled = (self.nameTextField.text.length > 0 && self.phoneNumberTextField.text.length > 0) ;
}
/***  点击saveBtn时调用,*/
- (void)save:(UIButton *)btn{// 销毁[self.navigationController popViewControllerAnimated:YES];self.contact.name = self.nameTextField.text ;self.contact.phoneNumber = self.phoneNumberTextField.text;if ([self.delegate respondsToSelector:@selector(editViewController:didSaveWithContact:)]) {[self.delegate editViewController:self didSaveWithContact:self.contact];}
}- (IBAction)editBtnDidClicked:(id)sender {if ([self.editBtn.title isEqualToString:@"编辑"]) {self.editBtn.title = @"取消";self.nameTextField.enabled = YES;self.phoneNumberTextField.enabled = YES;self.saveBtn.hidden = NO;[self.phoneNumberTextField becomeFirstResponder];}else {self.editBtn.title = @"编辑";[self.view endEditing:YES];self.nameTextField.enabled = NO;self.phoneNumberTextField.enabled = NO;self.saveBtn.hidden = YES;self.nameTextField.text = self.contact.name;self.phoneNumberTextField.text = self.contact.phoneNumber;}
}
@end



这篇关于第三十三篇:私人通迅录(有存储功能)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/983610

相关文章

SpringBoot3.X 整合 MinIO 存储原生方案

《SpringBoot3.X整合MinIO存储原生方案》本文详细介绍了SpringBoot3.X整合MinIO的原生方案,从环境搭建到核心功能实现,涵盖了文件上传、下载、删除等常用操作,并补充了... 目录SpringBoot3.X整合MinIO存储原生方案:从环境搭建到实战开发一、前言:为什么选择MinI

Qt使用QSqlDatabase连接MySQL实现增删改查功能

《Qt使用QSqlDatabase连接MySQL实现增删改查功能》这篇文章主要为大家详细介绍了Qt如何使用QSqlDatabase连接MySQL实现增删改查功能,文中的示例代码讲解详细,感兴趣的小伙伴... 目录一、创建数据表二、连接mysql数据库三、封装成一个完整的轻量级 ORM 风格类3.1 表结构

Python实现对阿里云OSS对象存储的操作详解

《Python实现对阿里云OSS对象存储的操作详解》这篇文章主要为大家详细介绍了Python实现对阿里云OSS对象存储的操作相关知识,包括连接,上传,下载,列举等功能,感兴趣的小伙伴可以了解下... 目录一、直接使用代码二、详细使用1. 环境准备2. 初始化配置3. bucket配置创建4. 文件上传到os

mysql表操作与查询功能详解

《mysql表操作与查询功能详解》本文系统讲解MySQL表操作与查询,涵盖创建、修改、复制表语法,基本查询结构及WHERE、GROUPBY等子句,本文结合实例代码给大家介绍的非常详细,感兴趣的朋友跟随... 目录01.表的操作1.1表操作概览1.2创建表1.3修改表1.4复制表02.基本查询操作2.1 SE

Java中调用数据库存储过程的示例代码

《Java中调用数据库存储过程的示例代码》本文介绍Java通过JDBC调用数据库存储过程的方法,涵盖参数类型、执行步骤及数据库差异,需注意异常处理与资源管理,以优化性能并实现复杂业务逻辑,感兴趣的朋友... 目录一、存储过程概述二、Java调用存储过程的基本javascript步骤三、Java调用存储过程示

MySQL之InnoDB存储引擎中的索引用法及说明

《MySQL之InnoDB存储引擎中的索引用法及说明》:本文主要介绍MySQL之InnoDB存储引擎中的索引用法及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录1、背景2、准备3、正篇【1】存储用户记录的数据页【2】存储目录项记录的数据页【3】聚簇索引【4】二

MySQL之InnoDB存储页的独立表空间解读

《MySQL之InnoDB存储页的独立表空间解读》:本文主要介绍MySQL之InnoDB存储页的独立表空间,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、独立表空间【1】表空间大小【2】区【3】组【4】段【5】区的类型【6】XDES Entry区结构【

SQLite3 在嵌入式C环境中存储音频/视频文件的最优方案

《SQLite3在嵌入式C环境中存储音频/视频文件的最优方案》本文探讨了SQLite3在嵌入式C环境中存储音视频文件的优化方案,推荐采用文件路径存储结合元数据管理,兼顾效率与资源限制,小文件可使用B... 目录SQLite3 在嵌入式C环境中存储音频/视频文件的专业方案一、存储策略选择1. 直接存储 vs

Golang如何用gorm实现分页的功能

《Golang如何用gorm实现分页的功能》:本文主要介绍Golang如何用gorm实现分页的功能方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录背景go库下载初始化数据【1】建表【2】插入数据【3】查看数据4、代码示例【1】gorm结构体定义【2】分页结构体

Java Web实现类似Excel表格锁定功能实战教程

《JavaWeb实现类似Excel表格锁定功能实战教程》本文将详细介绍通过创建特定div元素并利用CSS布局和JavaScript事件监听来实现类似Excel的锁定行和列效果的方法,感兴趣的朋友跟随... 目录1. 模拟Excel表格锁定功能2. 创建3个div元素实现表格锁定2.1 div元素布局设计2.