UIView停止交互(失去焦点):

设置userInteractionEnabled=NO, 获取交互设置YES.

能够应用于UIButton, UITextField等交互型控件.

[editButton setUserInteractionEnabled:YES];
editButton.userInteractionEnabled = NO;

实例:

#pragma mark ItemChooseViewDelegate
// 选择服务类型框
- (void) didSelectedItem {
NIDPRINTMETHODNAME();
_servicePos = _serviceItemListView.selectedIndex; // 设置Item位置 // 总价格
_totalPrice = (float)([_goodsList[_servicePos][@"Price"] floatValue]/100.0)*
[[_serviceNumList objectAtIndex:_servicePos] integerValue];
[_totalPriceLabel setText:[NSString stringWithFormat:@"%0.1f", _totalPrice]]; // 设置button状态
for (int i=0; i<_goodsList.count; ++i) {
// 选中
if (i == _servicePos) {
[[_titleLabelArray objectAtIndex:i] setTextColor: [UIColor blackColor]];
[[_priceLabelArray objectAtIndex:i] setTextColor: RGBCOLOR_HEX(0xff6000)];
[[_timesFieldArray objectAtIndex:i] setTextColor: [UIColor blackColor]];
[[_timesFieldArray objectAtIndex:i] setUserInteractionEnabled: YES];
[[_addBtnArray objectAtIndex:i] setUserInteractionEnabled:YES];
[[_subBtnArray objectAtIndex:i] setUserInteractionEnabled:YES];
continue;
}
// 未选中
[[_titleLabelArray objectAtIndex:i] setTextColor: [UIColor grayColor]];
[[_priceLabelArray objectAtIndex:i] setTextColor: [UIColor grayColor]];
[[_timesFieldArray objectAtIndex:i] setTextColor: [UIColor grayColor]];
[[_timesFieldArray objectAtIndex:i] setUserInteractionEnabled: NO];
[[_addBtnArray objectAtIndex:i] setUserInteractionEnabled:NO];
[[_subBtnArray objectAtIndex:i] setUserInteractionEnabled:NO];
}
}

IOS - UIView停止交互的更多相关文章

  1. IOS UIVIEW layer动画 总结(转)

    转发自:http://www.aichengxu.com/article/%CF%B5%CD%B3%D3%C5%BB%AF/16306_12.html   IOS UIVIEW layer动画 总结, ...

  2. Cordova - 与iOS原生代码交互2(使用Swift开发Cordova的自定义插件)

    在前一篇文章中我介绍了如何通过 js 与原生代码进行交互(Cordova - 与iOS原生代码交互1(通过JS调用Swift方法)),当时是直接对Cordova生成的iOS工程项目进行编辑操作的(添加 ...

  3. iOS与HTML5交互方法总结(转)

    今天小编在找技术文章的时候,发现这样一个标题:iOS与HTML5交互方法总结,怎么看着这么熟悉呢?   还以为是刚哥用了别的文章,点进去一看,原来是刚哥自己写的文章,他们转载的,而且还上了Dev St ...

  4. iOS与H5交互

    H5与App原生交互,一般会是前端页面中的JavaScript与App使用的原生开发语言的交互.技术方案应能达到以下要求: 在js与原生进行交互的时候能保证正常的正向调用逻辑返回,反向可以处理异步回调 ...

  5. IOS UIView圆角,阴影,边框,渐增光泽

    圆角 sampleView.layer.cornerRadius = 2.5; // 圓角的弧度sampleView.layer.masksToBounds = YES; 阴影 sampleView. ...

  6. iOS与H5交互遇到的坑

    之前的博客写过使用<JavaScriptCore/JavaScriptCore.h>库来实现与H5的交互,但是在项目中还是遇到了一些不得不踩的坑.在这里将我遇到的问题以及参考网上几位大神的 ...

  7. [转]IOS UIView 之属性篇

    [转载自:IOS UIView 之属性篇 From CSDN] UIView 继承于UIResponder             所遵守的协议有 NSCoding .UIAppearance. UI ...

  8. WebViewJavascriptBridge详细使用 iOS与H5交互的方案

    WebViewJavascriptBridge详细使用 源网址: https://www.cnblogs.com/jiang-xiao-yan/p/5345755.html    前言 WebView ...

  9. iOS与HTML5交互方法总结(修正)

    摘要 看了不少别人写的博客或者论坛,关于iOS与HTML5交互方法大概主要有5种方式: 1. 利用WKWebView进行交互(系统API) 2. 利用UIWebView进行交互(系统API) 3. 苹 ...

随机推荐

  1. opencv边缘滤波

    2018-03-0422:16:11 import cv2 as cv import numpy as np def bi_demo (image): print ("ceshi" ...

  2. Pro ASP.NET Core MVC 第6版翻译 目录页

    Pro ASP.NET Core MVC 第6版 目录 第一部分 第一章 ASP.NET Core MVC 的前世今生 第二章 第一个MVC应用程序(上) 第二章 第一个MVC应用程序(下) 第三章 ...

  3. postgreSQL在Centos6下编译安装

    1.准备安装源 下载地址:https://www.postgresql.org/ftp/source/ 下载并解压. 2.软件编译安装 配置.检查安装环境 ./configure --prefix=/ ...

  4. httponlycookie

    cookie cookie是目前标识用户身份一项非常流行的技术:设置httponly的cookie客户端是不能通过js来修改的:你以为这样就万事大吉,没有办法伪造了吗? 背景介绍 假设网站A通过设置h ...

  5. spring 实例 bean 的方式

    一.使用构造器实例化: <bean id="personService" class="cn.mytest.service.impl.PersonServiceBe ...

  6. Oracle RAC 后台进程

    LMS  - Gobal         全局缓存服务进程 LMD  - Global Enqueue Service Daemon 全局查询服务守护进程 LMON -  全局服务器监控进程 LCK0 ...

  7. luogu P4137 Rmq Problem / mex 主席树 + 思维

    Code: #include<bits/stdc++.h> #define maxn 200001 using namespace std; void setIO(string s) { ...

  8. java求两个集合的交集和并集,比较器

    求连个集合的交集: import java.util.ArrayList; import java.util.List; public class TestCollection { public st ...

  9. 诊断:记一次存储异常CRASH致数据库无法正常打开的恢复

    数据库存储异常crash,首先控制文件出现问题 ORA-: ????? ???? ORA-: ???? : '/oracledata/oradata/orc11rac/orc11rac/system0 ...

  10. Gym - 101670G Ice cream samples(CTU Open Contest 2017 尺取法)

    题目: To encourage visitors active movement among the attractions, a circular path with ice cream stan ...