当前位置: 首页 > news >正文

励志做的很好的网站市场营销策划案的范文

励志做的很好的网站,市场营销策划案的范文,怎么做页游,asp.net 4.0网站开发「OC」登陆界面 明确要求 一个登陆界面的组成#xff0c;用户名提示以及输入框#xff0c;密码提示提示以及输入框#xff0c;登陆按钮#xff0c;以及注册按钮#xff0c;根据以上要求我们将我们的组件设置为成员变量。 //viewControl.h #import UIKit/UIKit.h用户名提示以及输入框密码提示提示以及输入框登陆按钮以及注册按钮根据以上要求我们将我们的组件设置为成员变量。 //viewControl.h #import UIKit/UIKit.hinterface ViewController : UIViewControllerproperty (nonatomic) UILabel *lUserName; property (nonatomic) UILabel *lPassword;property (nonatomic) UITextField *tsUserName; property (nonatomic) UITextField *stPassword;property (nonatomic) UIButton *btnLogin; property (nonatomic) UIButton *btnRegister;end界面设置 根据以上的组件我们可以将组件进行编排代码如下可根据自身审美进行相关的排版 //viewControl.m - (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.self.view.backgroundColor [UIColor whiteColor];_lUserName [[UILabel alloc] initWithFrame:CGRectMake(20, 200, 80, 40)];_lUserName.text 用户名:;_lUserName.font [UIFont systemFontOfSize:20];_lUserName.textAlignment NSTextAlignmentLeft;_lPassword [[UILabel alloc] initWithFrame:CGRectMake(20, 260, 80, 40)];_lPassword.text 密码:;_lPassword.font [UIFont systemFontOfSize:20];_lPassword.textAlignment NSTextAlignmentLeft;_tsUserName [[UITextField alloc] initWithFrame:CGRectMake(120, 200, 180, 40)];_tsUserName.placeholder 请输入用户名;_stPassword [[UITextField alloc] initWithFrame:CGRectMake(120, 260, 180, 40)];_stPassword.placeholder 请输入密码;_stPassword.borderStyle UITextBorderStyleRoundedRect;_stPassword.secureTextEntry YES;_btnLogin [[UIButton alloc] initWithFrame:CGRectMake(100, 400, 80, 40)];_btnLogin.backgroundColor [UIColor redColor];[_btnLogin setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];[_btnLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];[_btnLogin setTitle:登录 forState:UIControlStateNormal];[_btnLogin addTarget:self action:selector(loginButtonTapped) forControlEvents:UIControlEventTouchUpInside];_btnRegister [[UIButton alloc] initWithFrame:CGRectMake(200, 400, 80, 40)];_btnRegister.backgroundColor [UIColor redColor];[_btnRegister setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];[_btnRegister setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];[_btnRegister setTitle:注册 forState:UIControlStateNormal];[_btnRegister addTarget:self action:selector(registerButtonTapped) forControlEvents:UIControlEventTouchUpInside];[self.view addSubview:_lUserName];[self.view addSubview:_lPassword];[self.view addSubview:_btnLogin];[self.view addSubview:_btnRegister];[self.view addSubview:_stPassword];[self.view addSubview:_tsUserName]; }实际界面展示如下 功能实现 由两个按钮注册和登陆可以知道我们需要实现两个功能登陆和注册我们先从注册开始 注册 由于我们想要保存多个账号和密码在本地我们可以直接通过文件操作来进行实现此处我选择使用SFileHandle进行文件的修改。我们方便我们后面登陆的读取我们还应该尽量让账号和密码的存储具有一定的格式。 //viewControl.m -(void)registerButtonTapped {NSString *username _tsUserName.text;NSString *password _stPassword.text;// 清空账号和密码字段_tsUserName.text ;_stPassword.text ;// 构造要写入文件的内容NSString *newUserData [NSString stringWithFormat:%,%\n, username, password];// 写入文件NSFileHandle *fileHandle [NSFileHandle fileHandleForWritingAtPath:/Users/bb/Desktop/NSString/JC登陆/文档.txt];//如果路径文件存在则进行操作if (fileHandle) {// 将文件指针移动到文件末尾[fileHandle seekToEndOfFile];// 将数据写入文件[fileHandle writeData:[newUserData dataUsingEncoding:NSUTF8StringEncoding]];// 关闭文件[fileHandle closeFile];// 注册成功提示UIAlertController *alert [UIAlertController alertControllerWithTitle:注册成功 message:您已成功注册新用户 preferredStyle:UIAlertControllerStyleAlert];UIAlertAction *okAction [UIAlertAction actionWithTitle:确定 style:UIAlertActionStyleDefault handler:nil];[alert addAction:okAction];[self presentViewController:alert animated:YES completion:nil];} else {// 文件操作失败提示UIAlertController *alert [UIAlertController alertControllerWithTitle:注册失败 message:无法写入用户数据 preferredStyle:UIAlertControllerStyleAlert];UIAlertAction *okAction [UIAlertAction actionWithTitle:确定 style:UIAlertActionStyleDefault handler:nil];[alert addAction:okAction];[self presentViewController:alert animated:YES completion:nil];} } 在此之外我们可以尽量规范用户的账号密码的格式和长度于是对以上程序进行改进完整的注册功能如下 -(void)registerButtonTapped {NSString *username _tsUserName.text;NSString *password _stPassword.text;// 清空账号和密码字段_tsUserName.text ;_stPassword.text ;// 检查用户名和密码是否满足要求if (![self validateUsername:username] || ![self validatePassword:password]) {// 用户名或密码不满足要求显示错误提示UIAlertController *alert [UIAlertController alertControllerWithTitle:注册失败 message:用户名或密码不符合要求 preferredStyle:UIAlertControllerStyleAlert];UIAlertAction *okAction [UIAlertAction actionWithTitle:确定 style:UIAlertActionStyleDefault handler:nil];[alert addAction:okAction];[self presentViewController:alert animated:YES completion:nil];return;}// 构造要写入文件的内容NSString *newUserData [NSString stringWithFormat:%,%\n, username, password];// 写入文件NSFileHandle *fileHandle [NSFileHandle fileHandleForWritingAtPath:/Users/bb/Desktop/NSString/JC登陆/文档.txt];if (fileHandle) {// 将文件指针移动到文件末尾[fileHandle seekToEndOfFile];// 将数据写入文件[fileHandle writeData:[newUserData dataUsingEncoding:NSUTF8StringEncoding]];// 清空账号和密码字段_tsUserName.text ;_stPassword.text ;// 关闭文件[fileHandle closeFile];// 注册成功提示UIAlertController *alert [UIAlertController alertControllerWithTitle:注册成功 message:您已成功注册新用户 preferredStyle:UIAlertControllerStyleAlert];UIAlertAction *okAction [UIAlertAction actionWithTitle:确定 style:UIAlertActionStyleDefault handler:nil];[alert addAction:okAction];[self presentViewController:alert animated:YES completion:nil];} else {// 文件操作失败提示UIAlertController *alert [UIAlertController alertControllerWithTitle:注册失败 message:无法写入用户数据 preferredStyle:UIAlertControllerStyleAlert];UIAlertAction *okAction [UIAlertAction actionWithTitle:确定 style:UIAlertActionStyleDefault handler:nil];[alert addAction:okAction];[self presentViewController:alert animated:YES completion:nil];} } - (BOOL)validateUsername:(NSString *)username {// 在这里添加用户名的验证规则例如// 用户名必须包含至少 6 个字符且只能包含字母和数字NSCharacterSet *allowedCharacters [NSCharacterSet alphanumericCharacterSet];if (username.length 6 || ![username rangeOfCharacterFromSet:allowedCharacters].length) {return NO;}return YES; }- (BOOL)validatePassword:(NSString *)password {// 在这里添加密码的验证规则例如// 密码必须包含至少 8 个字符且包含至少一个大写字母和一个数字NSCharacterSet *uppercaseCharacters [NSCharacterSet uppercaseLetterCharacterSet];NSCharacterSet *digitCharacters [NSCharacterSet decimalDigitCharacterSet];if (password.length 8 || ![password rangeOfCharacterFromSet:uppercaseCharacters].length || ![password rangeOfCharacterFromSet:digitCharacters].length) {return NO;}return YES; }登陆功能 登陆功能其实就是从文件当中找到相关的账号密码我们要注意的就是如何从文件之中读取正确的内容与用户输入的内容进行匹配我们就可以多加使用NSString之中方便的相关方法来进行操作。当我们登陆成功的时候我们就将JCHome这个控制其弹出。 我们需要进行视窗弹出时需要进行一些细节的实现 //SceneDelegate.m的内容 #import SceneDelegate.h #import ViewController.h interface SceneDelegate ()endimplementation SceneDelegate- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {UINavigationController *navigationController [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc]init] ];// 将导航控制器设置为窗口的根视图控制器self.window.rootViewController navigationController;self.window.frame [UIScreen mainScreen].bounds;[self.window makeKeyAndVisible]; } ______________________________________________________________________________________________________________________________ //JCHome.h #import UIKit/UIKit.hNS_ASSUME_NONNULL_BEGINinterface JCHome : UIViewController property (nonatomic, copy) NSString *userName; property (nonatomic, strong) UILabel *welcomeLabel; endNS_ASSUME_NONNULL_END ______________________________________________________________________________________________________________________________ //JCHome.m #import JCHome.hinterface JCHome ()endimplementation JCHome- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.self.view.backgroundColor [UIColor redColor];_welcomeLabel [[UILabel alloc] initWithFrame:CGRectMake(20, 100, CGRectGetWidth(self.view.frame) - 40, 40)];_welcomeLabel.textAlignment NSTextAlignmentCenter;_welcomeLabel.font [UIFont systemFontOfSize:24];_welcomeLabel.text [NSString stringWithFormat:欢迎%, self.userName];[self.view addSubview:_welcomeLabel]; }以下是登陆功能的实现 //viewControl.m -(void)loginButtonTapped {NSString *username _tsUserName.text;NSString *password _stPassword.text;// 在这里可以进行登录验证逻辑比如与文件中的数据进行比较// 从文件中读取数据NSString *fileData [NSString stringWithContentsOfFile:/Users/bb/Desktop/NSString/JC登陆/文档.txt encoding:NSUTF8StringEncoding error:nil];// 按行分割数据NSArray *lines [fileData componentsSeparatedByString:\n];for (NSString *line in lines) {// 按照特定的规则解析每行数据比如使用逗号分隔字段NSArray *fields [line componentsSeparatedByString:,];// 获取用户名和密码字段NSString *storedUsername fields[0];NSString *storedPassword fields[1];if ([storedUsername isEqualToString:username] [storedPassword isEqualToString:password]) {// 登录成功NSLog(登陆成功);JCHome *homeVC [[JCHome alloc] init];homeVC.userName username; // 将用户名传递给下一个界面实现多界面传值[self.navigationController pushViewController:homeVC animated:YES];return;}}UIAlertController *alert [UIAlertController alertControllerWithTitle:登陆失败 message:账号或密码错误 preferredStyle:UIAlertControllerStyleAlert];UIAlertAction *okAction [UIAlertAction actionWithTitle:确定 style:UIAlertActionStyleDefault handler:nil];[alert addAction: okAction];[self presentViewController:alert animated:YES completion:nil];} 如果登陆成功则会弹出下一个界面
http://www.yayakq.cn/news/1605/

相关文章:

  • 沈阳的网站制作公司哪家好搜索引擎广告投放
  • 网站做app开发wordpress视频教程式
  • 网站备案号链接做盈利网站怎么备案
  • 深圳做营销网站的公司小米路由wordpress
  • 网站公司建设网站建设规划书电商
  • 做自己的网站不是免费的镇海区建设交通局网站进不去了
  • 做特卖网站有什么网站asp网站转wap网站
  • 网站制作公司咨询网站制作公司沈阳网站建设培训班
  • 网站维护包含哪些内容月夜直播免费完整版观看
  • 高端网站建设成都中秋节网页设计代码
  • 开一个网站多少钱屯济宁做网站公司
  • 有没有教做衣服的网站做网站看网页效果
  • 如何建设教育信息网站怎样做美瞳网站
  • 网站下载工具没有域名能做网站吗
  • 哪个网站可以做线上翻译赚钱微信代运营是什么意思
  • 做网站策划书吧云谷 网站建设
  • 江西建设职业技术学院迎新网站中文域名注册 .网站
  • 澄迈住房和城乡建设局网站手机版网页制作
  • 网店网站建设哪家北京撒网站设计
  • html5 素材网站编程猫官网
  • 郑州企业网站怎么优化网文网站开发方案
  • seo网站关键词快速排名免费网站建设可信吗
  • 主网站下建立子目录站鞍山网站制作云端
  • 怎么在国外网站买东西石油 技术支持 东莞网站建设
  • 东莞前10大互联网公司襄阳抖音seo找哪家
  • 公司网站上传图库公司集团网站开发
  • 怎么黑网站中国网财经
  • 学做网站难吗eclipse开发微网站开发
  • 做自媒体查找素材的网站技术网站源码wordpress
  • 怎么做企业网站原型网站及网页设计费用