Get Picture Cache
1. Import
#import "SDImageCache.h"
Convert B units to M
[NSString stringwithformat:@ "%.2FM", (double) [[Sdimagecache Sharedimagecache] getsize]/1000/1000];
Clear the picture cache
[[Sdimagecache Sharedimagecache] cleardisk];
Get all file caches in a folder
Folder Enumerator, you can enumerate all the files within this folder and subfolders of this folder
Nsdirectoryenumerator *enumerator = [[Nsfilemanager Defaultmanager] Enumeratoratpath:<[commontool Filedownloadpath]>>> the path of the folder that needs to be traversed];
unsigned long long totalsize = 0;
while ([Enumerator nextobject])
{
Totalsize+=[[enumerator FileAttributes] fileSize];
}
[NSString stringwithformat:@ "%.2FM", (double) totalsize/1000/1000];
Clean up the file cache
[[Nsfilemanager Defaultmanager] Removeitematpath:<[commontool filedownloadpath]>>> need to delete the folder path via Error:nil ];
Auto-Hide Tabbar when push
vc.hidesbottombarwhenpushed = YES;
Self-adapting height
CGRect rect = [_news.intr-needs to get the string-Boundingrectwithsize:cgsizemake (screen_width-30>-needs to be a wide line, 0) options: nsstringdrawinguseslinefragmentorigin| Nsstringdrawingusesfontleading Attributes:@{nsfontattributename:[uifont boldsystemfontofsize:14]} Context:nil];
return rect.size.height+30;
Get the height of the keyboard input box adaptive
_inputview is a custom View plus textField input box
[[Nsnotificationcenter defaultcenter]addobserver:self selector: @selector (keyboardwillchangeframe:) Name: Uikeyboardwillchangeframenotification Object:nil];
-(void) Keyboardwillchangeframe: (nsnotification *) noti{
NSLog (@ "%@", noti.userinfo);
CGRect rect = [[Noti.userinfo Objectforkey:uikeyboardframeenduserinfokey] cgrectvalue];
[UIView Animatewithduration:[[noti.userinfo Objectforkey:uikeyboardanimationdurationuserinfokey] FloatValue] animations:^{
_inputview.frame = CGRectMake (0, rect.origin.y-40, Screen_width, 40);
_tableview.frame = CGRectMake (0, 0, screen_width, _INPUTVIEW.FRAME.ORIGIN.Y);
}];
}
---slide your keyboard down
-(void) scrollviewwillbegindragging: (Uiscrollview *) scrollview{
[Self.view Endediting:yes];
}
Bubble chat dedicated from a pixel point lachen
Self.bubbleImageView.image = [[UIImage imagenamed:@ "Bubbleself.png"] stretchableimagewithleftcapwidth:25 TOPCAPHEIGHT:20];
Set the photo as a round regular avatar
Self.headerImageView.layer.cornerRadius = 30-The radius of the photo size;
Self.headerImageView.layer.masksToBounds = YES;
Set the corner label for the app icon
[[UIApplication sharedapplication] setapplicationiconbadgenumber:number-need to obtain the number];
iOS Trivia points