个人总结(3.1)

1.在第一个程序里打开第二个程序
二个程序里添加 URL type选项,继续点加号有 URL Schemes(URL 方案?),数组类型的,给一个 字符串作为第一个程序打开的标识符, 另外有一个URL idenifier,不知道干嘛,标准为 com.app2.test 类似的.
第一个程序添加 LSApplicationQueriesSchemes 字段,数组类型,添加第二个程序的URL Schemes
这里写图片描述
打开代码:

NSURL * url = [NSURL URLWithString:@"app2://"];
    if ([[UIApplication sharedApplication]canOpenURL:url]) {
        NSLog(@"can open");
        [[UIApplication sharedApplication]openURL:url];
    }
    else{
        NSLog(@"can not");
    }

我们设置的URL Scheme为 app2 ,stirng类型就写做 app2://.
2.label添加html字符串,也可以将html字符串的某些格式用正则表达式表示出来方便单独的挑选.

NSString * htmlStr = @"<p><span style = 'FONT-SIZE:40px/'>class</span></p>";
        NSAttributedString * attributeStr = [[NSAttributedString alloc]initWithData:[htmlStr dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil];
    label.attributedText = attributeStr;

3.双引号代替单引号

NSString * str = @"\"hello\"";
    NSString * str2 = [str stringByReplacingOccurrencesOfString:@"\"" withString:@"\'"];
    NSLog(@"%@",str2);

4.可以创建类别方法,调用方法来更像系统的方法
5.用alertController表示以前的Actionsheet

alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    [alert addAction:[UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

   }]];
   [alert addAction:[UIAlertAction actionWithTitle:@"从相册中选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

   }]];
   [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

    }]];
   [self presentViewController:alert animated:YES completion:nil];

6.

NSDictionary * paramDic = @{
                                @"userId":codeStr,
                                @"tokenCode":tokenCodeStr
                                };

这样更方便些吧.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值