From af10cadc9d2a197dc992bb8fa30776e0851c224a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E7=A6=8F=E6=88=90?= Date: Thu, 11 Apr 2019 20:19:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=86=85=E5=AD=98=E4=BD=BF=E7=94=A8=E9=87=8F=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8E=9F=E6=96=B9=E6=B3=95=E4=B8=8D=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YYCategories/UIKit/UIApplication+YYAdd.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/YYCategories/UIKit/UIApplication+YYAdd.m b/YYCategories/UIKit/UIApplication+YYAdd.m index 4ea2647..e92a4d9 100644 --- a/YYCategories/UIKit/UIApplication+YYAdd.m +++ b/YYCategories/UIKit/UIApplication+YYAdd.m @@ -123,11 +123,11 @@ - (BOOL)isBeingDebugged { } - (int64_t)memoryUsage { - struct task_basic_info info; - mach_msg_type_number_t size = sizeof(info); - kern_return_t kern = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); + task_vm_info_data_t vmInfo; + mach_msg_type_number_t count = TASK_VM_INFO_COUNT; + kern_return_t kern = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t)&vmInfo, &count); if (kern != KERN_SUCCESS) return -1; - return info.resident_size; + return vmInfo.phys_footprint; } - (float)cpuUsage { From 43ef201f69d00f1b903ddb50b964fb93819caff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E7=A6=8F=E6=88=90?= Date: Thu, 11 Apr 2019 20:20:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=AF=B9=E5=BA=94Block=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8E=9F=E6=96=B9=E6=B3=95=E4=BC=9A=E5=B0=86=E6=89=80?= =?UTF-8?q?=E6=9C=89=E4=BA=8B=E4=BB=B6=E9=83=BD=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YYCategories/UIKit/UIControl+YYAdd.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YYCategories/UIKit/UIControl+YYAdd.m b/YYCategories/UIKit/UIControl+YYAdd.m index 4ae42aa..db420ca 100644 --- a/YYCategories/UIKit/UIControl+YYAdd.m +++ b/YYCategories/UIKit/UIControl+YYAdd.m @@ -81,7 +81,7 @@ - (void)addBlockForControlEvents:(UIControlEvents)controlEvents - (void)setBlockForControlEvents:(UIControlEvents)controlEvents block:(void (^)(id sender))block { - [self removeAllBlocksForControlEvents:UIControlEventAllEvents]; + [self removeAllBlocksForControlEvents:controlEvents]; [self addBlockForControlEvents:controlEvents block:block]; }