当前位置:网站首页>share总结
share总结
2022-08-04 04:11:00 【山河丘壑】
前言
在第二周进行了share的界面仿写,相比网易云和ZARA界面的仿写,share的难度明显很大,任务俩个也很多。浅浅总结一下这一周仿写的share
界面构成
- 启动界面
定时器实现即可,启动界面接下来的的是登陆界面,所以在定时器的时间函数里转向登陆界面即可。
- 登陆界面
需要实现账号密码的输入,使用TextField来接收虚拟键盘的输入
在登陆界面还需要添加确定登陆和注册的按钮,当点击确定登陆时,界面转向share首页。点击注册界面时,界面转向注册界面。
登陆界面还需要实现一个自动登录的按钮。当选择了这个按钮并输入密码账号后,直接转向share首页。
- 注册界面
三个TextField,一个用来接收邮箱地址,一个接收密码,另一个接收账号。
一个按确认注册,点击次按钮后,界面转向登陆界面
- share首页
无限轮播图+自定义cell。
无限轮播图使用NSTimer定时器来实现,
自定义cell需要实现点赞功能
- 搜索界面
TextField来接收键盘输入内容实现搜索
右分类,推荐,时间三个按钮来添加搜索条件。
上传按钮实现内容上传
- 文章界面
三个按钮对应不同分类下的文章
- 活动界面
TableView来实现活动内容的添加
- 个人信息
头像部分
我上传的 桑哥标签实现不同条件下的文章上传的搜索
我的信息 1.新关注的: 实现关注和非关注的按钮的状态的改变和保存。2私信:自定义cell
设置 : 1.基本资料: 要求修改性别按钮的实现 。 2.修改密码: 要求三个TextField来接收原始密码,修改密码和确定密码。如果两个输入的修改后密码不一致,使用警告对话框来提示密码输入不一致。如果两个输入修改密码相同,提示修改成功。3.消息设置:要求能改变并保存各个按钮的状态。4.清除缓存,警告对话框提示修改成功,两秒后警告对话框消失。
问题
控制栏的图标设置
//share普通,share按压是要添加的图片名称。
fenView.tabBarItem = [[UITabBarItem alloc]
initWithTitle:nil image:[[UIImage imageNamed:@"share普通"]imageWithRenderingMode:
UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:
@"share按压"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
添加效果:share按压
share普通
导航栏颜色的修改(前景+后景)
使用MAC自带的数码测色器来测出自己要求改的颜色的数值。
、
//修改后景颜色
//这里的47.0,132.0,169.0是数码测色器测出来的三项数值。其他的内容是格式
self.navigationController.navigationBar.backgroundColor=[UIColor colorWithRed:47.0/255.0 green:132.0/255.0 blue:169.0/255.0 alpha:10.f];
//修改前景+后景颜色
UINavigationBarAppearance* apperance = [UINavigationBarAppearance new];
[apperance configureWithOpaqueBackground];
apperance.backgroundColor = [UIColor colorWithRed:47.0/255.0 green:132.0/255.0 blue:169.0/255.0 alpha:10.f];
apperance.shadowColor = [UIColor clearColor];
self.navigationController.navigationBar.standardAppearance = apperance;
self.navigationController.navigationBar.scrollEdgeAppearance = self.navigationController.navigationBar.standardAppearance;
只修改后景颜色
修改前景+后景颜色
自动轮播图
这里是timer代码和党使用手势拖动时停止和开始NSTimer的代码
//timer函数
- (void)timer{
int dir = self.sv.contentOffset.x/self.view.frame.size.width;
if(dir!=3){
//这个函数可以给自动轮播图添加轮播效果
[self.sv setContentOffset:CGPointMake(self.view.frame.size.width*(dir%4 + 1), 0) animated:YES];
}else{
self.sv.contentOffset = CGPointMake(0, 0);
}
}
//timer的停止
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
_timer.fireDate = [NSDate distantFuture];
}
//timer的开始
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
_timer.fireDate = [NSDate dateWithTimeIntervalSinceNow:1.0f];
}
实现按钮按下时背景的改变和状态的保存
//按钮的时间函数
- (void)press:(UIButton*)btn{
UIImage* image = [UIImage imageNamed:@"背景"];
[btn setImage:image forState:UIControlStateSelected];
if (btn.selected == YES){
btn.selected = NO;
return;
} else{
btn.selected = YES;
return;
}
}
键盘回收
//点击屏幕空白处键盘回收
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self.textField resignFirstResponder];
}
使用手势滑动屏幕
在第三界面要求实现使用手势滑动后劲儿按钮按压两个效果。
按钮按压的函数可以直接让跳转到对应的界面
使用手势滑动时,按钮的状态也应该对应起来。所以在当屏幕开始滑动的函数里写上按钮状态改变的内容
//按钮按压后页面跳转的函数
- (void)press3{
self.sv.contentOffset = CGPointMake(self.view.frame.size.width*2, 0);
}
清除缓存
点击button4清除缓存按钮后,1秒后弹出一个警告对话框提示清除成功,再过两秒警告对话框自动消失
- (void)pressBtn4{
NSTimer* timerView = [[NSTimer alloc]init];
timerView = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timer) userInfo:nil repeats:NO];
}
- (void)timer{
UIAlertController* alertView = [UIAlertController alertControllerWithTitle:@"提示" message:@"缓存清除成功" preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alertView animated:YES completion:nil];
[self performSelector:@selector(dismiss:)withObject:alertView afterDelay:2];
}
总结
- 键盘无法弹出时,在虚拟机里找到设置->General->Keyboards->HardWare Keyboard->按下shift+commend+k即可
- 上传照片使用的是协议传值,将最后一张图片和上传图片张数一并传到第一界面
- 首页点赞应该使用传值
- 按钮状态的保存,应该是把Second窗口写成Firest窗口的一个属性。
边栏推荐
猜你喜欢
7. The principle description of LVS load balancing cluster
"Introduction to nlp + actual combat: Chapter 8: Using Pytorch to realize handwritten digit recognition"
张量篇-应用案例
Gigabit 2 X light 8 electricity management industrial Ethernet switches WEB management - a key Ring Ring net switch
【 observe 】 super fusion: the first mention of "calculate net nine order" evaluation model, build open prosperity of power network
6-port full Gigabit Layer 2 network managed industrial Ethernet switch Gigabit 2 optical 4 electrical fiber self-healing ERPS ring network switch
一文详解DHCP原理及配置
将xml标签转换为txt(voc格式转换为yolo方便进行训练)
The general SQL injection flow (sample attached)
A Preliminary Study of RSS Subscription to WeChat Official Account-feed43
随机推荐
SQL interview Questions
Postgresql source code (66) insert on conflict grammar introduction and kernel execution process analysis
"Introduction to nlp + actual combat: Chapter 8: Using Pytorch to realize handwritten digit recognition"
文件内容的操作
烧录场景下开发如何进行源代码保密工作
马尔可夫链
Basic characteristics of TL431 and oscillator circuit
软件测试如何系统规划学习呢?
【技巧】借助Sentinel实现请求的优先处理
Take care of JVM performance optimization (own note version)
JVM的内存模型简介
SQL injection in #, - +, - % 20, % 23 is what mean?
汇编语言之栈
The general SQL injection flow (sample attached)
2.15 keil使用电脑端时间日期
8. Haproxy builds a web cluster
《nlp入门+实战:第八章:使用Pytorch实现手写数字识别》
元宇宙“吹鼓手”Unity:疯狂扩局,悬念犹存
Gigabit 2 X light 8 electricity management industrial Ethernet switches WEB management - a key Ring Ring net switch
劝退背后。