Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新UIApplication的memoryUsage方法和UIControl的setBlockForControlEvents方法 #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions YYCategories/UIKit/UIApplication+YYAdd.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion YYCategories/UIKit/UIControl+YYAdd.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down