使用 JSPatch 目前遭遇两个问题,不知道如何解决? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Dean
V2EX    iDev

使用 JSPatch 目前遭遇两个问题,不知道如何解决?

  •  
  •   Dean 2016-08-12 18:31:52 +08:00 5978 次点击
    这是一个创建于 3417 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题 1 使用 Masonry 写在 block 中链式方式实现的约束如何转成 js

    [talkButton mas_remakeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.topView.mas_centerX); make.width.equalTo(self.topView).multipliedBy(70/75.0);; make.height.equalTo(self.topView.mas_height).multipliedBy(88/210.0); make.centerY.equalTo(self.topicText.mas_centerY); }]; 

    问题 2 使用调用单例方法设置值一直出错

    [[UserInfoManager sharedInstance] setPublishOrder:info]; //参数类型 NSDictionary 

    ps:目前使用 Xcode7.3 出现一个问题如果出现 jx 执行出错就卡死,必须杀进程,花费了大量的调试时间

    12 条回复    2016-11-25 22:34:48 +08:00
    songz
        1
    songz  
       2016-08-12 21:00:04 +08:00
    去微博 @ bang
    Dean
        2
    Dean  
    OP
       2016-08-12 21:55:10 +08:00
    @songz bang 是那位大神难道是开源库作者,微博好久不上了去找下帐号
    jiyee
        3
    jiyee  
       2016-08-12 22:31:07 +08:00
    ```
    self.bottomButton().mas__remakeConstraints(block('MASConstraintMaker *', function(make) {
    make.centerY().equalTo()(self.bottomView());
    make.height().equalTo()(self.bottomView());
    make.right().equalTo()(self.bottomView());
    make.width().equalTo()(100);
    }));
    ```

    第二个不好判断。
    expkzb
        4
    expkzb  
       2016-08-12 22:40:30 +08:00
    抛弃 Masonry 改用 PureLayout 就好了(逃)
    xi_lin
        5
    xi_lin  
       2016-08-13 21:47:16 +08:00
    1. https://github.com/bang590/JSPatch/issues/93
    如果提前准备好宏包装的类的话会比较方便

    2. 你这样写不对吧?你在 JSPatch 里是怎么写的?
    amon
        6
    amon  
       2016-08-15 11:47:56 +08:00
    talkButton.mas_remakeConstraints(block('MASConstraintMaker*', function(make) {
    make.centerX().equalTo()(self.topView().mas_centerX());
    make.width().equalTo()(self.topView()).multipliedBy()(70 / 75.0);;
    make.height().equalTo()(self.topView().mas_height()).multipliedBy()(88 / 210.0);
    make.centerY().equalTo()(self.topicText().mas_centerY());
    }));

    直接使用 JSPatch Convertor 转换的,楼主可以试用下可行不。
    另外文档中有关于 block 的写法。
    fishcat
        7
    fishcat  
       2016-08-26 11:26:01 +08:00
    关注一下,第一需要展开可以看下 https://github.com/bang590/JSPatch/issues/109
    fishcat
        8
    fishcat  
       2016-08-26 11:28:18 +08:00
    不好意思,我刚发现这个竟然没有编辑功能,习惯性的 control + enter
    Masonry 调试好之后可以教教我, 第二个 应该比较好解决可以看一下 https://github.com/bang590/JSPatch/wiki
    Dean
        9
    Dean  
    OP
       2016-08-26 17:43:59 +08:00
    @fishcat Masonry 问题已解决,主要是注意方法名称带下划线的再添加下划线
    ```objc
    talkButton.mas__remakeConstraints(block('MASConstraintMaker *', function(make) {
    make.centerX().equalTo()(slf.topView().mas__centerX());
    make.centerY().equalTo()(slf.topicText().mas__centerY());
    make.width().equalTo()(slf.topView().mas__width()).multipliedBy()(70/75.0);
    make.height().equalTo()(slf.topView().mas__height()).multipliedBy()(88/210.0);
    }));
    ```
    Dean
        10
    Dean  
    OP
       2016-08-26 17:45:25 +08:00
    @amon 直接转换出来的方法名称有下划线没有变成两个下划线被 js 执行出错
    fishcat
        11
    fishcat  
       2016-08-29 09:18:08 +08:00
    @Dean 谢谢楼主,却是没有问题,犯了跟 sd_webImage 同样的错误
    cyanbox
        12
    cyanbox  
       2016-11-25 22:34:48 +08:00
    UserInfoManager.sharedInstance().setPublishOrder(info);
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2646 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 24ms UTC 08:51 PVG 16:51 LAX 00:51 JFK 03:51
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86