当前位置: 首页 > 编程日记 > 正文

RAC -代替OC 中的代理

学以致用,
有的时候学习了很多理论
却还是忘了实践

OC 中代替代理 简洁编程

#import "ViewController.h"
#import <ReactiveObjC.h>
#import "SKView.h"
@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.SKView *vw = [[SKView alloc]initWithFrame:CGRectMake(50, 200, 100, 100)];// 创建一个subject 赋值给view 的内部RACSubject *subject = [RACSubject subject];// 接受信号[subject subscribeNext:^(id  _Nullable x) {NSLog(@"点击了事件");}];vw.subject = subject;vw.backgroundColor = [UIColor redColor];[self.view addSubview:vw];}

@interface SKView : UIView@property(nonatomic,strong)RACSubject *subject;@end#import "SKView.h"@implementation SKView- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{[self.subject sendNext:@"我被点击了"];}@end

相关文章:

深度学习 免费课程_深入学习深度学习,提供15项免费在线课程

深度学习 免费课程by David Venturi大卫文图里(David Venturi) 深入学习深度学习&#xff0c;提供15项免费在线课程 (Dive into Deep Learning with 15 free online courses) Every day brings new headlines for how deep learning is changing the world around us. A few e…

《音乐商店》第4集:自动生成StoreManager控制器

一、自动生成StoreManager控制器 二、查看 StoreManager 控制器的代码 现在&#xff0c;Store Manager 控制器中已经包含了一定数量的代码&#xff0c;我们从头到尾重新过一下。 1.访问数据库代码 首先&#xff0c;在控制器中包含了标准的 MVC 控制器的代码&#xff0c;为了使用…

StringUtils

/需要导入第三方jar包pinyin4j.jarimport net.sourceforge.pinyin4j.PinyinHelper;import java.util.regex.Matcher; import java.util.regex.Pattern;public class StringUtils {protected static final String TAG StringUtils.class.getSimpleName();/*** 增加空白*/public…

微信支付invalid total_fee 的报错

因为我的测试商品是0.01的 原因是微信支付的金额是不能带小数点的 直接在提交的时候 乘以 100操作 &#xff0c;因为里面设置参数的时候是 以分为单位的 [packageParams setObject: price forKey:"total_fee"]; //订单金额&#xff0c;单位为分

帧编码 场编码_去年,我帮助举办了40场编码活动。 这是我学到的。

帧编码 场编码by Florin Nitu通过弗洛林尼图 去年&#xff0c;我帮助举办了40场编码活动。 这是我学到的。 (I helped host 40 coding events last year. Here’s what I learned.) Our local freeCodeCamp study group in Brasov, Romania just held its 40th event. We even…

HDU 4540 威威猫系列故事――打地鼠(DP)

D - 威威猫系列故事――打地鼠Time Limit:100MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4540Description 威威猫最近不务正业&#xff0c;每天沉迷于游戏“打地鼠”。 每当朋友们劝他别太着迷游戏&#xff0c;应该好好工…

iOS 在每一个cell上添加一个定时器的方案

1 首先创建一个数组&#xff0c;用来创建所有的定时器的时间 - (NSMutableArray *)totalLastTime {if (!_totalLastTime) {_totalLastTime [NSMutableArray array];}return _totalLastTime; }2 当从网络请求过来时间之后&#xff0c;循环遍历&#xff0c;行数和时间作为Key&a…

用字符串生成二维码

需要导入Zxing.jar包import android.graphics.Bitmap;import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterException; import com.google.zxing.common.BitMatrix;public class ZxingCode {/** * 用字符串生成…

在JavaScript中重复字符串的三种方法

In this article, I’ll explain how to solve freeCodeCamp’s “Repeat a string repeat a string” challenge. This involves repeating a string a certain number of times.在本文中&#xff0c;我将解释如何解决freeCodeCamp的“ 重复字符串重复字符串 ”挑战。 这涉及重…

杭电2099 整除的尾数

题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid2099 解题思路&#xff1a;将a扩大100倍之后&#xff0c;再给它从加上i(i从0到99)&#xff0c;一个一个的看哪一个能整除 反思&#xff1a;末两位是00的时候输出的是00&#xff08;这种情况题目里面的测试数据给…

iOS 验证码倒计时按钮

具体使用 [SmsTimerManager sharedManager].second (int)time; [[SmsTimerManager sharedManager] resetTime]; [SmsTimerManager sharedManager].delegate self; [strongSelf updateTime];设置代理方法 更新按钮的标题 (void)updateTime { if ([SmsTimerManager sharedMan…

树莓派centos安装的基本配置

萌新再发一帖&#xff0c;这篇文章呢主要是为大家在树莓派上安装centos以后提供一个问题的解决方案。 首先我呢觉得好奇就在某宝上花了两百来块钱买了一套树莓派&#xff0c;很多人喜欢在树莓派上安装Debian&#xff0c;我呢更青睐用Red Hat的系统&#xff0c;毕竟对Red Hat更熟…

token拦截器阻止连接_如何防止广告拦截器阻止您的分析数据

token拦截器阻止连接TL;DR Theres dataunlocker.com service coming soon (subscribe!), along with the open-sourced prototype you can use for Google Analytics or Google Tag Manager (2020 update).TL; DR即将推出dataunlocker.com服务 (订阅&#xff01;)&#xff0c;以…

使用Fiddler手机抓包https-----重要

Fiddler不仅可以对手机进行抓包&#xff0c;还可以抓取别的电脑的请求包&#xff0c;今天就想讲一讲使用Fiddler手机抓包&#xff01; 使用Fiddler手机抓包有两个条件&#xff1a; 一&#xff1a;手机连的网络或WiFi必须和电脑&#xff08;使用fiddler&#xff09;连的网络或Wi…

strtok和strtok_r

strtok和strtok_r原型&#xff1a;char *strtok(char *s, char *delim); 功能&#xff1a;分解字符串为一组字符串。s为要分解的字符串&#xff0c;delim为分隔符字符串。 说明&#xff1a;首次调用时&#xff0c;s指向要分解的字符串&#xff0c;之后再次调用要把s设成NULL。 …

iOS 标签自动布局

导入SKTagFrame SKTagFrame *frame [[SKTagFrame alloc] init];frame.tagsArray self.bigModel.Tags;// 添加标签CGFloat first_H 0;CGFloat total_H 0;for (NSInteger i 0; i< self.bigModel.Tags.count; i) {UIButton *tagsBtn [UIButton buttonWithType:UIButtonT…

引导分区 pbr 数据分析_如何在1小时内引导您的分析

引导分区 pbr 数据分析by Tim Abraham蒂姆亚伯拉罕(Tim Abraham) 如何在1小时内引导您的分析 (How to bootstrap your analytics in 1 hour) Even though most startups understand how critical data is to their success, they tend to shy away from analytics — especial…

SSL 1460——最小代价问题

Description 设有一个nm(小于100)的方格&#xff08;如图所示&#xff09;&#xff0c;在方格中去掉某些点&#xff0c;方格中的数字代表距离&#xff08;为小于100的数&#xff0c;如果为0表示去掉的点&#xff09;&#xff0c;试找出一条从A(左上角)到B&#xff08;右下角&am…

在Windows 7下面IIS7的安装和 配置ASP的正确方法

在Windows 7下如何安装IIS7&#xff0c;以及IIS7在安装过程中的一些需要注意的设置&#xff0c;以及在IIS7下配置ASP的正确方法。 一、进入Windows 7的 控制面板&#xff0c;选择左侧的打开或关闭Windows功能 。二、打开后可以看到Windows功能的界面&#xff0c;注意选择的项目…

适配iOS 13 tabbar 标题字体不显示以及返回变蓝色的为问题

// 适配iOS 13 tabbar 标题字体不显示以及返回变蓝色的为问题 if (available(iOS 13.0, *)) {//[[UITabBar appearance] setUnselectedItemTintColor:Color_666666];}

企业不要求工程师资格认证_谁说工程师不能成为企业家?

企业不要求工程师资格认证by Preethi Kasireddy通过Preethi Kasireddy 谁说工程师不能成为企业家&#xff1f; (Who says engineers can’t become entrepreneurs?) A lot of people warned me not to walk away from my great position at Andreessen Horowitz to pursue so…

BestCoder Round #92 比赛记录

上午考完试后看到了晚上的BestCoder比赛,全机房都来参加 感觉压力好大啊QAQ,要被虐了. 7:00 比赛开始了,迅速点进了T1 大呼这好水啊!告诉了同桌怎么看中文题面 然后就开始码码码,4分16秒AC了第一题 7:05 开始看第二题 诶诶诶!!~~~~直接爆搜不久能过吗? 交了一发爆搜上去,AC了,…

[cocos2dx UI] CCLabelAtlas 为什么不显示最后一个字

CClabelAtlas优点&#xff0c;基本用法等我就不说了&#xff0c;这里说一个和美术配合时的一个坑&#xff01;就是图片的最后一位怎么也不显示&#xff0c;如下图中的冒号不会显示 查了ASCII码表&#xff0c;这个冒号的值为58&#xff0c;就是在9&#xff08;57&#xff09;的后…

iOS 13 适配TextField 崩溃问题

iOS 13 之后直接通过以下方式修改Textfield的时候会出现报错信息 [_accountText setValue:Color_666666 forKeyPath:"_placeholderLabel.textColor"]; 报错信息 Access to UITextField’s _placeholderLabel ivar is prohibited. This is an application bug 解决…

测试django_如何像专业人士一样测试Django Signals

测试djangoby Haki Benita通过Haki Benita 如何像专业人士一样测试Django Signals (How to test Django Signals like a pro) For a better reading experience, check out this article on my website.为了获得更好的阅读体验&#xff0c;请在我的网站上查看此文章 。 Djang…

C#中静态方法的运用和字符串的常用方法(seventh day)

又来到了今天的总结时间&#xff0c;由于昨天在云和学院学的知识没有弄懂&#xff0c;今天老师又专门给我们非常详细地讲了一遍&#xff0c;在这里非常谢谢老师。O(∩_∩)O 话不多说&#xff0c;下面就开始为大家总结一下静态方法的运用和字符串的常用方法。 理论&#xff1a;静…

raid 磁盘阵列

mkdir /uuu #建挂载目录echo "- - -" > /sys/class/scsi_host/host2/scan #扫描新硬盘 lsblk #查看 parted /dev/sdb #分区 parted /dev/sdc lsblk mdadm -Cv /dev/md1 -l1 -n2 -c128 /dev/sd[b,c]1 #raid1配置&#xff0c; /dev/md1名字&#…

iOS 13 如何删除SceneDelegate

Xcode11之后新创建的工程会多出两个文件SceneDelegate。那么我们如何让它变回之前的那样的工程呢。 一、将这两个文件删除。 会报错There is no scene delegate set. A scene delegate class must be specified to use a main storyboard file. 二、将Info.plist 中的 SceneMai…

女性程序员大会ghc_在女性科技大会上成为男人的感觉

女性程序员大会ghcby Elijah Valenciano通过伊莱贾瓦伦西亚诺 在女性科技大会上成为男人的感觉 (What It’s Like to be a Man at a Women’s Tech Conference) To be honest, I was very nervous. A few panicked thoughts started to flood my mind as I prepared myself to…

cf776G.Sherlock and the Encrypted Data

题意:对于一个16进制数x,把x的各个数位拿出来,设其为t1,t2,...,定义s(x)为2^t1|2^t2|...,如x0x3e53,则s(x)2^3|2^14|2^5|2^316424.给出q组询问l,r(l,r也是16进制数,不超过15位),求[l,r]中有多少个数x满足x^s(x)<x. 这题题解写的是个状压数位dp,但是蒟蒻不会数位dp,自己YY了一…