正确的姿势打开/关闭定时器
关闭
[timer setFireDate:[NSDate distantFuture]];
打开
[timer setFireDate:[NSDate distantPast]];
获取最上层view的方法
1. [[UIApplication sharedApplication].windows lastObject]
2. [UIApplication sharedApplication].keywindow.subviews
访问系统铃声路径
NSString *path = [NSString stringWithFormat:@"/Library/Ringtones/%@.caf",@"Apex"];
NSLog(@"%@",path);
UIAlertController使用方法
CTReportTextModel *reportTextModel = self.dataArray[0];
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"确定不要当前的图片了吗" message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
weakSelf.imagePath = reportTextModel.imageName;
[alertView addAction:cancel];
UIAlertAction *certain = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self.dataArray removeAllObjects];
[weakSelf.tableView reloadData];
}];
[alertView addAction:certain];
[self presentViewController:alertView animated:YES completion:nil];
网友评论