#pragma mark -清除Document 数据
- (void)clearUpSDocumentDirectory
{
NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) firstObject];
NSArray *documentfiles = [[NSFileManager defaultManager] subpathsAtPath:documentPath];
for (NSString *dp in documentfiles) {
NSError *error;
if (![dp isEqualToString:@"switchchoose.data"]) {
NSString *path = [documentPath stringByAppendingPathComponent:dp];
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
}
}
}
}
#pragma mark 清除TemporaryDirectory数据
- (void)clearUpTemporaryDirectory
{
NSString *tmpPath = NSTemporaryDirectory();
NSArray *tmpfiles = [[NSFileManager defaultManager] subpathsAtPath:tmpPath];
for (NSString *tp in tmpfiles) {
NSError *error;
NSString *path = [tmpPath stringByAppendingPathComponent:tp];
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
}
}
}
#pragma mark 清除LibraryDirectory数据
- (void)clearUpLibraryDirectory
{
NSString *cachPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask, YES) firstObject];
NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachPath];
for (NSString *p in files) {
NSError *error;
NSString *path = [cachPath stringByAppendingPathComponent:p];
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
}
}
}
- (UITableView *)tableView{
if (_tableView) return _tableView;
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth , kScreenHeight-NavBar_Height) style:UITableViewStyleGrouped];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.backgroundColor=[UIColor colorWithHexString:@"e9e9e9"];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
return _tableView;
}