Web前端最新iOS组件化方案-总结第一篇(3),三个月没找到工作面试怎么说

文末

如果30岁以前,可以还不知道自己想去做什么的话,那30岁之后,真的觉得时间非常的宝贵,不能再浪费时间在一些碎片化的事情上,比如说看综艺,电视剧。一个人的黄金时间也就二,三十年,不能过得浑浑噩噩。所以花了基本上休息的时间,去不断的完善自己的知识体系,希望可以成为一个领域内的TOP。

同样是干到30岁,普通人写业务代码划水,榜样们深度学习拓宽视野晋升管理。

这也是为什么大家都说30岁是程序员的门槛,很多人迈不过去,其实各行各业都是这样都会有个坎,公司永远都缺的高级人才,只用这样才能在大风大浪过后,依然闪耀不被公司淘汰不被社会淘汰。

269页《前端大厂面试宝典》

包含了腾讯、字节跳动、小米、阿里、滴滴、美团、58、拼多多、360、新浪、搜狐等一线互联网公司面试被问到的题目,涵盖了初中级前端技术点。

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

前端面试题汇总

JavaScript

创建CRProtocolManager类(.h,.m),定义2个对外接口

@interface CRProtocolManager : NSObject

  • (void)registServiceProvide:(id)provide forProtocol:(Protocol*)protocol;

  • (id)serviceProvideForProtocol:(Protocol *)protocol;

@end

具体方法实现很简单可以参看Demo,我这里只是简单处理。

接下来就是要把项目提交到gitHub,做私有pod了

  • gitHub新建一个project名为CRProtocolManager

  • 终端cd至CRProtocolManager项目目录下执行命令git remote add origin https://github.com/sun6boys/CRProtocolManager.git

  • 因cocoaPods强制添加开源许可文件执行命令echo MIT>FILE_LICENSE创建名为FILE_LICENSE的文件

  • 终端cd至CRProtocolManager目录下执行命令pod spec create CRProtocolManager

  • 执行命令vim .CRProtocolManager.podspec编辑podspec文件,具体如何编辑可参看Demo中的podspec文件或者google

  • 退出编辑执行命令git add .

  • `git commit -m ‘log’

  • git tag 0.0.1 tag一定要和podspec中的version一致

  • git push origin master --tags --tags为了把刚才添加的tag提交上去

  • 执行命令pod repo push CRRepositories CRProtocolManager.podspec --verbose --allow-warnings 注:CRRepositories即为准备工作中的私有源仓库

  • 成功后pod search CRProtocolManager应该就能搜索到了

万里长征终于走完第一步,基础设施已经构建完毕

3.商品详情业务模块

既然组件化了,那我们所有的业务模块都是单独的project,但是这里我会分2个project,一个是商品详情业务入口模块,一个是商品详情业务模块。业务入口模块即是定义该模块对外提供业务接口的protocol,如果A模块需要调用到B模块,那A模块只需要引入CRProtocolManager和B模块的protocol,而不是引入整个B模块。

新建一个projectCRGoodsDetailServiceProtocol,创建一个和项目名一样的protocol文件,定义接口如下

@protocol CRGoodsDetailServiceProtocol

@required;

  • (UIViewController )goodsDetailViewControllerWithGoodsId:(NSString)goodsId goodsName:(NSString *)goodsName;

@end

参照CRProtocolManager做成私有pod

以上实施完毕,新建一个projectCRGoodsDetail,新建2个类

CRGoodsDetailServiceProvide

CRGoodsDetailViewController

CRGoodsDetailServiceProvide即是CRGoodsDetailServiceProtocol的实现者 所以他依赖

CRGoodsDetailServiceProtocol,因为商品详情模块需要跳转到订单确认页,所以他也依赖CRProtocolManager

添加Podfile文件编辑如下

source ‘https://github.com/sun6boys/CRRepositories.git’

source ‘https://github.com/CocoaPods/Specs.git’

target ‘CRGoodsDetail’ do

pod “CRProtocolManager”

pod “CRGoodsDetailServiceProtocol”

end

执行pod install --verbose --no-repo-update

最终CRGoodsDetailServiceProvide实现代码如下

#import “CRGoodsDetailServiceProvide.h”

#import <CRGoodsDetailServiceProtocol/CRGoodsDetailServiceProtocol.h>

#import <CRProtocolManager/CRProtocolManager.h>

#import “CRGoodsDetailViewController.h”

@interface CRGoodsDetailServiceProvide()

@end

@implementation CRGoodsDetailServiceProvide

  • (void)load

{

[CRProtocolManager registServiceProvide:[[self alloc] init] forProtocol:@protocol(CRGoodsDetailServiceProtocol)];

}

  • (UIViewController )goodsDetailViewControllerWithGoodsId:(NSString)goodsId goodsName:(NSString *)goodsName

{

CRGoodsDetailViewController *goodsDetailVC = [[CRGoodsDetailViewController alloc] initWithGoodsId:goodsId goodsName:goodsName];

return goodsDetailVC;

}

@end

CRGoodsDetailViewController实现代码如下

#import “CRGoodsDetailViewController.h”

@interface CRGoodsDetailViewController ()

@property (nonatomic, copy) NSString *goodsId;

@property (nonatomic, copy) NSString *goodsName;

@property (nonatomic, strong) UILabel *statusLabel;

@property (nonatomic, strong) UIButton *buyButton;

@end

@implementation CRGoodsDetailViewController

  • (instancetype)initWithGoodsId:(NSString *)goodsId goodsName:(NSString *)goodsName

{

self = [super init];

if (self) {

_goodsId = goodsId;

_goodsName = goodsName;

}

return self;

}

  • (void)viewDidLoad {

[super viewDidLoad];

self.navigationItem.title = self.title;

[self.view addSubview:self.statusLabel];

[self.view addSubview:self.buyButton];

}

  • (void)viewWillLayoutSubviews

{

[super viewWillLayoutSubviews];

self.statusLabel.frame = CGRectMake(0, 0, 100, 20);

self.statusLabel.center = self.view.center;

self.buyButton.frame = CGRectMake(0, self.view.frame.size.height - 45, self.view.frame.size.width, 45);

}

#pragma mark - event

  • (void)didClickBuyButton:(UIButton *)button

{

}

#pragma mark - getters

  • (UILabel *)statusLabel

{

if (_statusLabel == nil) {

_statusLabel = [[UILabel alloc] init];

_statusLabel.textColor = [UIColor redColor];

_statusLabel.font = [UIFont systemFontOfSize:15.f];

_statusLabel.textAlignment = NSTextAlignmentCenter;

_statusLabel.text = @“暂未购买”;

}

return _statusLabel;

文末

篇幅有限没有列举更多的前端面试题,小编把整理的前端大厂面试题PDF分享出来,一共有269页

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

  • 13
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值