美文网首页
iOS 工作中遇到的问题 (五)

iOS 工作中遇到的问题 (五)

作者: 翻滚的炒勺2013 | 来源:发表于2017-01-04 16:56 被阅读27次

正确的姿势打开/关闭定时器

关闭
[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];

相关文章

网友评论

      本文标题:iOS 工作中遇到的问题 (五)

      本文链接:https://www.haomeiwen.com/subject/nnznvttx.html