解藕的好处: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. Centos7.2 安装配置 Tengine(nginx)

    一.下载tengine wget http://tengine.taobao.org/download/tengine-2.2.2.tar.gz 二.安装tenginx(nginx)的模块依赖库 yu ...

  2. HDU - 6081 2017百度之星资格赛 度度熊的王国战略

    度度熊的王国战略  Accepts: 644  Submissions: 5880  Time Limit: 40000/20000 MS (Java/Others)  Memory Limit: 3 ...

  3. NSMutableAttributedString及NSMutableParagraphStyle的使用

    一.在iOS开发中,常常会有一段文字显示不同的颜色和字体,或者给某几个文字加删除线或下划线的需求.之前在网上找了一些资料,有的是重绘UILabel的textLayer,有的是用html5实现的,都比较 ...

  4. sed命令用法

    Sed 简介 sed 是一种新型的,非交互式的编辑器.它能执行与编辑器 vi 和 ex 相同的编辑任务.sed 编辑器没有提供交互式使用方式,使用者只能在命令行输入编辑命令.指定文件名,然后在屏幕上查 ...

  5. 登录案例version1 基本登录+验证码

    package com.frxx.web.servlet; import com.frxx.domain.User; import com.frxx.service.impl.UserServiceI ...

  6. CC12:链式A+B

    题目 有两个用链表表示的整数,每个结点包含一个数位.这些数位是反向存放的,也就是个位排在链表的首部.编写函数对这两个整数求和,并用链表形式返回结果. 给定两个链表ListNode* A,ListNod ...

  7. response.setContentType() 作用及参数用法

    笔者感冒了,转载大神的 https://blog.csdn.net/luman1991/article/details/53423305 下载中设置文件名称 https://blog.csdn.net ...

  8. 服务是如何加载并运行的, Kestrel、配置与环境

    服务是如何加载并运行的, Kestrel.配置与环境 "跨平台"后的ASP.Net Core是如何接收并处理请求的呢? 它的运行和处理机制和之前有什么不同? 本章从"宏观 ...

  9. F. Coprime Subsequences 莫比乌斯反演

    http://codeforces.com/contest/803/problem/F 这题正面做了一发dp dp[j]表示产生gcd = j的时候的方案总数. 然后稳稳地超时. 考虑容斥. 总答案数 ...

  10. 2016-2017 ACM-ICPC, NEERC, Southern Subregional Contest A. Toda 2 贪心 + 暴力

    A. Toda 2 time limit per test 2 seconds memory limit per test 512 megabytes input standard input out ...