用于创建报告的 Cocoa IB Elements

发布于 2024-12-27 02:11:47 字数 1105 浏览 2 评论 0原文

我正在开发一个应用程序来显示活动和活动中的圈数。我对 Cocoa 相当陌生,但已经创建了一个基本界面来显示“活动”数组的内容,然后响应一个按钮来显示所有选定活动的圈数和一些摘要数据。以下是类结构:

活动类:

  • activityDate
  • sport
  • laps[]

Lap Class:

  • startTime
  • 时间 距离
  • 最大速度
  • 平均速度
  • 最大步数
  • 平均步数
  • 卡路里
  • 平均心跳
  • 最大心跳
  • 强度

我真正想做的是显示一个报告视图,其中显示每个选定的活动及其圈数详细信息和摘要底部有一个大摘要,我可以打印出来。

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 来解决这个问题。

有什么想法和可能的例子吗?

I'm developing an app to display Activities and the Laps within the Activities. I'm fairly new to Cocoa, but have created a basic interface to display the contents of the Activities array and then respond to a button to display the Laps and some summary data for all the selected Activities. Here are the class structures:

Activity Class:

  • activityDate
  • sport
  • laps[]

Lap Class:

  • startTime
  • totalTime
  • distance
  • maximumSpeed
  • averageSpeed
  • maximumPace
  • averagePace
  • calories
  • averageHeartbeat
  • maximumHeartbeat
  • intensity

What I really want to do is display a report view that shows each selected Activity with its Lap details and summary and a grand summary at the bottom, which I can print.

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  ...

The summaries are totals and averages depending on the value. I want column headings and possible row highlighting for the summaries.

I've looked at possibly using an NSOutlineView, as I want everything to be nicely aligned in columns, but don't know how to use two different classes for the display. I tried once to do this using HTML to create a NSTextView, with okay results. However, I really don't want to generate HTML to solve this.

Any ideas and possible examples?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千年*琉璃梦 2025-01-03 02:11:47

经过研究,我找不到在IB中实现我想要的接口的方法。我重新使用 WebView 和 HTML 来生成报告结果。使用表格和 CSS,我能够创建一组看起来相当令人愉快的报告,并且可以轻松打印。

这是生成的 HTML,因为我无法发布图像(我对 stackoverflow 还太陌生)。

    <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'> </td><td class='lap'>5.9 mph</td><td class='lap'> </td><td class='lap'>425</td><td class='lap'> </td><td class='lap'> </td></tr>
    </table>

After research, I could not find a way to implement the interface I wanted in IB. I went back to using a WebView and HTML to generate the report results. Using tables and CSS, I was able to create a rather pleasant looking set of reports that can print easily.

Here is the HTML generated, as I cannot post an image (I'm too new to stackoverflow).

    <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'> </td><td class='lap'>5.9 mph</td><td class='lap'> </td><td class='lap'>425</td><td class='lap'> </td><td class='lap'> </td></tr>
    </table>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文