swift - 按可选日期排序自定义对象数组

时间:2015-06-24 19:29:19

标签: ios xcode swift cocoa-touch

我有一系列自定义对象。我希望按<div id="menu"> <button class="btn" id="btn1" data-rel-page="div1">Pag1</button> <button class="btn" id="btn2" data-rel-page="div2">Pag2</button> <button class="btn" id="btn3" data-rel-page="div3">Pag3</button> <button class="btn" id="btn4" data-rel-page="div4">Pag4</button> </div> <div id="div1" class="fullscreen active"> <center>HOME</center> </div> <div id="div2" class="fullscreen"> <center>PAGE2</center> </div> <div id="div3" class="fullscreen"> <center>PAGE3</center> </div> <div id="div4" class="fullscreen"> <center>PAGE4</center> </div> $(document).ready(function () { var current = "div1"; $("[data-rel-page]").bind('click', function (evt) { var el = $(evt.currentTarget).attr('data-rel-page'); if (el === current) return; var $el = $("#" + el); var $cur = $("#" + current); current = el; $cur.removeClass('active'); $el.addClass('active'); }) }); 属性对它们进行排序,但此属性是可选的,在某些情况下可能为零。 如何对升序的对象进行排序,以便最终显示零日期? 以下是我现在使用的内容,但是当nil日期发生时它会失败:

.fullscreen {
    transition: all 0.4s linear;
    position: fixed;
    bottom: 0px;
    left: 0px;
    right: 0px;
    height: 0%;
    overflow: hidden;
}

.fullscreen.active {
    display: block;
    height: 100%;
}

0 个答案:

没有答案