IOC注解框架
2017-08-22 本文已影响32人
CaoMeng
最近利用空闲时间学习了一点东西IOC属性注解、事件注解、网络注解,其实很感谢那些无私分享的作者,通过看他们分享内容自己也在进步,希望自己在工作学习的路上坚持不懈。下面只是自己的学习之后的理解,通过简书写下来让自己记忆
更深刻,不是为了博眼球,只是通过自己的理解写出来。首先感谢原著Drren无私分享。
下面是写这个框架的具体步骤:
1、通过@interface自定义一个ViewById注解

2、写一个findViewId的类:这个用于寻找id

3、写一个找到id的工具类
(1)兼容传进来的参数为view、this

(2)注解属性

4注入事件
(1)通过@interface自定义一个OnCliick注解

(2)通过@interface自定义一个CheckNet注解

(3)事件的注入

(4)设置点击方法

(5)判断网络状况的方法

一套IOC注解框架就搭建完成了,第一次写这个,没有经验,下次会做的更好一点!!!加油!!!