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 · 5227 次点击
    这是一个创建于 2806 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题 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   ·   我们的愿景   ·   实用小工具   ·   3477 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 00:42 · PVG 08:42 · LAX 17:42 · JFK 20:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.