2012-01-13 58 views
0

我正在開發一個應用程序來顯示活動中的活動和圈次。我對Cocoa相當陌生,但創建了一個基本界面來顯示Activities數組的內容,然後響應按鈕以顯示所有選定活動的Laps和一些摘要數據。下面是類結構:可可IB元素創建報告

活動類別:

  • activityDate
  • 運動
  • 圈[]

臘類:

  • STARTTIME
  • TOTALTIME
  • 距離
  • maximumSpeed
  • averageSpeed
  • maximumPace
  • averagePace
  • 卡路里
  • averageHeartbeat
  • maximumHeartbeat
  • 強度

我真正想要做的是顯示一個報告視圖,顯示每個選定的活動及其圈數詳細信息和總結以及底部的總結,我可以打印。

Running Oct-22-2011 10:10:14 AM 
       Lap 1 10:10:14 AM 3.80 mi 42:48 11:16/mi ... 
          Summary 3.80 mi 42:48 11:16/mi ... 

Running Oct-24-2011 04:07:06 PM 
     Lap 1 04:07:06 PM 3.10 mi 31:19 10:06/mi ... 
     Lap 2 04:38:31 PM 3.10 mi 31:16 10:05/mi ... 
        Summary 6.20 mi 1:02:36 10:05/mi .... 

       Grand Summary 10.0 mi 1:45:25 10:29/mi ... 

總結和總計取決於價值。我想要列標題和可能的行高亮摘要。

我看過可能使用NSOutlineView,因爲我希望一切都很好地在列中對齊,但不知道如何使用兩個不同的類來顯示。我嘗試過一次使用HTML來創建NSTextView,結果不錯。但是,我真的不想生成HTML來解決這個問題。

任何想法和可能的例子?

回答

0

經過研究,我無法找到實現IB所需接口的方法。我回到使用WebView和HTML生成報告結果。使用表格和CSS,我能夠創建一個相當愉快的報告集,可以輕鬆打印。

這裏是生成的HTML,因爲我不能發佈圖片(我太新,不能用於計算器)。

<table class='first'> 
     <tr class='activity'><td>Running</td><td colspan='10' align='left'>Oct 2, 2011 11:29 AM</td></tr> 
     <tr class='lap'><th></th><th>Start Time</th><th>Distance</th><th>Elapsed Time</th><th>Avg Pace</th><th>Max Pace</th><th>Avg Speed</th><th>Max Speed</th><th>Calories</th><th>Avg Heartrate</th><th>Max Heartrate</th></tr> 
     <tr class='lapdetails'><td></td><td class='lap'>11:29:53 AM</td><td class='lap'>3.68 mi</td><td class='lap'>38:21.62</td><td class='lap'>10:25/mi</td><td class='lap'>5:43/mi</td><td class='lap'>5.8 mph</td><td class='lap'>10.5 mph</td><td class='lap'>449</td><td class='lap'>0</td><td class='lap'>0</td></tr> 
     <tr class='activitysummary'><td>Totals:</td><td class='lap'></td><td class='lap'>3.68 mi</td><td class='lap'>38:21.62</td><td class='lap'>10:25/mi</td><td class='lap'>5:43/mi</td><td class='lap'>5.8 mph</td><td class='lap'>10.5 mph</td><td class='lap'>449</td><td class='lap'>0</td><td class='lap'>0</td></tr> 
    </table> 
    <table> 
     <tr class='activity'><td>Running</td><td colspan='10' align='left'>Oct 7, 2011 12:22 PM</td></tr> 
     <tr class='lap'><th></th><th>Start Time</th><th>Distance</th><th>Elapsed Time</th><th>Avg Pace</th><th>Max Pace</th><th>Avg Speed</th><th>Max Speed</th><th>Calories</th><th>Avg Heartrate</th><th>Max Heartrate</th></tr> 
     <tr class='lapdetails'><td></td><td class='lap'>12:22:59 PM</td><td class='lap'>3.18 mi</td><td class='lap'>31:17.35</td><td class='lap'>9:49/mi</td><td class='lap'>6:44/mi</td><td class='lap'>6.1 mph</td><td class='lap'>8.9 mph</td><td class='lap'>402</td><td class='lap'>148</td><td class='lap'>171</td></tr> 
     <tr class='activitysummary'><td>Totals:</td><td class='lap'></td><td class='lap'>3.18 mi</td><td class='lap'>31:17.35</td><td class='lap'>9:49/mi</td><td class='lap'>6:44/mi</td><td class='lap'>6.1 mph</td><td class='lap'>8.9 mph</td><td class='lap'>402</td><td class='lap'>148</td><td class='lap'>171</td></tr> 
    </table> 
    <table> 
     <tr class='activity'><td colspan='11'>Summary</td></tr> 
     <tr class='lap'><th></th><th>Activities</th><th>Distance</th><th>Elapsed Time</th><th>Avg Pace</th><th>Max Pace</th><th>Avg Speed</th><th>Max Speed</th><th>Calories</th><th>Avg Heartrate</th><th>Max Heartrate</th></tr> 
     <tr class='activitysummary'><td class='lap'></td><td class='lap'>2</td><td class='lap'>6.86 mi</td><td class='lap'>1:09:38.97</td><td class='lap'>10:07/mi</td><td class='lap'>5:43/mi</td><td class='lap'>5.9 mph</td><td class='lap'>10.5 mph</td><td class='lap'>851</td><td class='lap'>148</td><td class='lap'>171</td></tr> 
     <tr class='activitysummary'><td class='lap'></td><td class='lap'>per Activity</td><td class='lap'>3.43 mi</td><td class='lap'>34:49.49</td><td class='lap'>10:07/mi</td><td class='lap'>&nbsp;</td><td class='lap'>5.9 mph</td><td class='lap'>&nbsp;</td><td class='lap'>425</td><td class='lap'>&nbsp;</td><td class='lap'>&nbsp;</td></tr> 
    </table> 
相關問題