解藕的好处:UI内部模块能够灵活的变化。

MVC或者三层架构着重强调了数据、业务逻辑和UI的分离。

(MVC中的C只是UI和业务逻辑模块间的一个中转组件,理论上应该是个轻模块。)

以前的关注的解藕技术比耦合多;重点强调了现实与数据、业务逻辑的解藕;现实与数据的耦合则很少关注。

UI展示的主要工作:内容、样式、布局。

视图的分类:

简单视图:单一信息源视图;uilabel、uiiamgeview

符合视图:数据源为结构体;

数据源类型:

可配置;

不可配置;

UI布局的定制需求:需要开放接口给外面。

View开发定式:

1)配置子视图;loadSbuviews configSubviews

2)配置布局;  自动布局  layoutsubviews;

3)配置数据;      loadDatas; 如果使用自动布局,配置数据后不用进行二次布局;否则需要二次布局。

数据配置与在MVC中的位置。

数据配置接口是视图层与业务逻辑层的接口。

理论上只有与业务逻辑有关的视图需要有这个接口。

UI的大部分功能还是信息展示和用户交互。

系统UI的支持(UIView):

事件处理:UIView : UIResponder

视图布局UIView(UIViewGeometry)

UIView (UIConstraintBasedLayoutCoreMethods)

视图组合:UIView(UIViewHierarchy)

视图样式(渲染):(UIViewRendering)

系统UI的数据接口支持(uilabel):

数据: @property(nullable, nonatomic,copy)   NSString           *text;

样式: @property(null_resettable, nonatomic,strong) UIFont      *font;

@property(null_resettable, nonatomic,strong) UIColor     *textColor;

@property(nullable, nonatomic,strong) UIColor            *shadowColor;

@property(nonatomic)        CGSize             shadowOffset;

MVC中的C:主要工作是UI导航。

https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW6

Checklist for Implementing a Custom View

The job of a custom view is to present content and manage interactions with that content. The successful implementation of a custom view involves more than just drawing and handling events, though. The following checklist includes the more important methods you can override (and behaviors you can provide) when implementing a custom view:

  • Define the appropriate initialization methods for your view:
    • For views you plan to create programmatically, override the initWithFrame: method or define a custom initialization method.
    • For views you plan to load from nib files, override the initWithCoder: method. Use this method to initialize your view and put it into a known state.
  • Implement a dealloc method to handle the cleanup of any custom data.
  • To handle any custom drawing, override the drawRect: method and do your drawing there.
  • Set the autoresizingMask property of the view to define its autoresizing behavior.
  • If your view class manages one or more integral subviews, do the following:
    • Create those subviews during your view’s initialization sequence.
    • Set the autoresizingMask property of each subview at creation time.
    • If your subviews require custom layout, override the layoutSubviews method and implement your layout code there.

https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW6

Views

Because view objects are the main way your application interacts with the user, they have many responsibilities. Here are just a few:

  • Layout and subview management
    • A view defines its own default resizing behaviors in relation to its parent view.
    • A view can manage a list of subviews.
    • A view can override the size and position of its subviews as needed.
    • A view can convert points in its coordinate system to the coordinate systems of other views or the window.
  • Drawing and animation
    • A view draws content in its rectangular area.
    • Some view properties can be animated to new values.
  • Event handling
    • A view can receive touch events.
    • A view participates in the responder chain.

This chapter focuses on the steps for creating, managing, and drawing views and for handling the layout and management of view hierarchies. For information about how to handle touch events (and other events) in your views, see Event Handling Guide for UIKit Apps.

UI与数据分离 与 UI的演进的更多相关文章

  1. jQuery MiniUI开发系列之:UI和数据分离

    使用MiniUI需要注意:UI和数据是分离的. 传统的WEB开发,开发者经常将数据库操作.服务端业务.HTML标签写在一个页面内. 这样会造成开发的混乱,并且难以维护和升级. 使用MiniUI开发的时 ...

  2. WPF MVVM UI分离之《交互与数据分离》

    在我们使用WPF过程中,不可避免并且超级喜欢使用MVVM框架. 那么,使用MVVM的出发点是视觉与业务逻辑分离,即UI与数据分离 诸如下面的问题: 删除操作,假如需要先执行一部分数据的处理,然后删除界 ...

  3. WPF MVVM UI分离之《交互与数据分离》 基础才是重中之重~delegate里的Invoke和BeginInvoke 将不确定变为确定系列~目录(“机器最能证明一切”) 爱上MVC3系列~全局异常处理与异常日志 基础才是重中之重~lock和monitor的区别 将不确定变成确定~我想监视我的对象,如果是某个值,就叫另一些方法自动运行 将不确定变成确定~LINQ DBML模型可以对

    WPF MVVM UI分离之<交互与数据分离>   在我们使用WPF过程中,不可避免并且超级喜欢使用MVVM框架. 那么,使用MVVM的出发点是视觉与业务逻辑分离,即UI与数据分离 诸如下 ...

  4. WPF / Win Form:多线程去修改或访问UI线程数据的方法( winform 跨线程访问UI控件 )

    WPF:谈谈各种多线程去修改或访问UI线程数据的方法http://www.cnblogs.com/mgen/archive/2012/03/10/2389509.html 子线程非法访问UI线程的数据 ...

  5. JQuery Easy Ui dataGrid 数据表格 ---制作查询下拉菜单

    JQuery Easy Ui dataGrid 数据表格 数据表格 - DataGrid 继承$.fn.panel.defaults,使用$.fn.datagrid.defaults重载默认值.. 数 ...

  6. Android实战开发租赁管理软件(适配UI,数据的存储,多线程下载)课程分享

    亲爱的网友,我这里有套课程想和大家分享,假设对这个课程有兴趣的,能够加我的QQ2059055336和我联系. 课程内容简单介绍 我们软件是基于移动设备的.所以我们必定的选择了安卓作为我们的开发工具.课 ...

  7. 【微信小程序】数据与界面UI不同步,不能直接操作Page.data

    问题:数据层与UI不同步 微信小程序也采用UI绑定数据源的形式,根据以前做WPF的经验,直觉上认为修改了数据层(Page.data)后,UI会自动更新,然而实验发现数据层修改后UI层未修改,导致数据层 ...

  8. 关于mvvm:UI、数据、绑定、状态、中间变量、数据适配、数据处理

    绑定: UI控件 --> VM    VM -> UI控件 关于mvvm:UI.数据.绑定.状态.中间变量.数据适配.数据处理: https://github.com/zzf073/Log ...

  9. IOS开发UI基础--数据刷新

    IOS开发UI基础--数据刷新 cell的数据刷新包括下面几个方面 加入数据 删除数据 更改数据 全局刷新方法(最经常使用) [self.tableView reloadData]; // 屏幕上的全 ...

随机推荐

  1. monkey无规则压力测试

    例:monkey -p com.tencent.mtaexample -s 23  --throttle 100 --ignore-crashes --ignore-timeouts -v -v -v ...

  2. JavaScript 的基本语法

    说明:此类博客来自以下链接,对原内容做了标注重点知识,此处仅供自己学习参考! 来源:https://wangdoc.com/javascript/basic/introduction.html 1. ...

  3. SCUT - 157 - CC和他的GCD - 容斥原理

    https://scut.online/p/157 鉴于多年(都没几个月)搞数论的经验,这种时候枚举g肯定是对的. 那么肯定是要莫比乌斯函数作为因子,因为很显然? 但是为什么要搞个负的呢?其实是因为这 ...

  4. SQL 截取字段空格之前的数据

    MYSQL group by left(city,LOCATE(' ',city)) SQL select a,left(a,charindex( ' ',a)) FROM test SELECT g ...

  5. 《SQL 进阶教程》 case:将已有编号方式转换为新的方式并统计

    SQL 权威指南SQL 解惑在进行非定制化统计时,需要将已有编号方式转换为另外一种便于分析的方式进行统计需求 select case when name='哈尔滨' then '黑龙江' when n ...

  6. SpringBoot用户CRUD

    1.准备 http://start.spring.io/ 这里地址去直接生成你需要的项目信息,如何你本身ide以及集成了springboot 那么可以直接生成项目信息 需要的知识:java,sprin ...

  7. js 检查字符串中是否包含中文(正则)

    function CheckChinese(val){ var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); if(r ...

  8. python进阶03 继承

    python进阶03 继承 一.继承 课堂练习:假设你正在参与一个魔幻类角色游戏的开发,公司需要腻味这个游戏设计两个角色的类: a.剑士 属性:1.角色名:2.角色等级:3.生命值:4.攻击力 行为: ...

  9. [LOJ 2039] 「SHOI2015」激光发生器

    [LOJ 2039] 「SHOI2015」激光发生器 链接 链接 题解 分为两个部分 第一个是求直线之间的交点找到第一个触碰到的镜面 第二个是求直线经过镜面反射之后的出射光线 第一个很好做,第二个就是 ...

  10. Uvalive-4494-(数位dp)

    题意:求a->b中的二进制出现过多少个1,很显然的数位dp,对于某一位来说,如果这位是0,那么dp[i]=dp[i-1]  如果这一位是1 那么dp[i]=dp[i-1]+1<<(p ...