首页 > 移动平台 > 详细

ios 开发小记 (五)

时间:2015-11-06 16:01:08      阅读:213      评论:0      收藏:0      [点我收藏+]

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"取消订单" message:@"取消这次订单" preferredStyle:UIAlertControllerStyleAlert];
   
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"否" style:UIAlertActionStyleDefault handler:nil];
    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"是" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
         [[OrderMessage instance] requestCancelUserOrder:order_id];
    }];
    [alertController addAction:okAction];
    [alertController addAction:cancelAction];
   
    [self presentViewController:alertController animated:YES completion:nil];
 
 
一个是上拉菜单选择;一个是弹出框选择;
    UIAlertControllerStyleActionSheet,
    UIAlertControllerStyleAlert
 
 
PhoneCallDelegate
在IOS里面使用代理模式,切记切记,__weak必须加。
 
 
__weak UIViewController* controller = self;
    [dataSource setSelectCallBack:^(long index, id data) {
        UIViewController* dance = controller;
        Order* order = (Order*)data;
        open_order_id = order.order_id.integerValue;
        [controller performSegueWithIdentifier:@"open_order_detail" sender:controller];
    }];
在一个block中使用了self时,需要使用weak-strong dance。
如果把block赋值给自己持有的变量,切记把block引用设置为weak。
 
 
注意,上面的代码有bug, __weak __typeof(self) controller = self;才是正确的用法。
 
 
通过segue打开一个页面,包括UItextView,text里面只有abc的字母的时候,会卡死,找不到原因。
 
 
 
 
引人:

    iOS真机调试程序,报如下错误信息:

failed to get the task for process XXX 

原因:

证书问题,project和targets的证书都必须是开发证书,ADHOC的证书会出现此问题。

解决方案:

    project和targets的证书使用开发证书
 
 
 
 
 
创建尺寸至少为 44 像素 x 44 像素的控件
 
 
 
 
闭包和 block 都是独立的内存对象,会 retain 它们所引用的对象,因此如果我们有个类,里面有个闭包变量,并且这个闭包恰好引用了自身所属对象的一个属性或方法,那么就可能产生循环引用
[self onBack]; 代码放在函数里。
 

 

 

 

png的图片只是命名为png,格式不是png的。

 打开terminal终端,cd图片目录,输入命令sips -s format png *.* --out pngs,再把图片覆盖即可
 

ios 开发小记 (五)

原文:http://www.cnblogs.com/loying/p/4942663.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!