How to read and write to a table?

Hi,

I have been trying for a while now to find a solution for an app I am trying to make for an A level project, I have messed around with code suggested on this forum for hours now however have not had much luck trying to get it to do what I want. I thought I would try to describe a bit better the problem I am trying to solve as I now know a little more what I need to do.


I essentiallly want to have a tableView that has items, each of which have a few different headings with different values. Basically like an excel spreadsheet, the row heading being the table item title and each column heading being a title for a value, each row having a different value for the same title. I need to be able to read and write to this table using multiple steppers to increment a value for each column heading and all this then need to be readable. I also need each entry/row to have a time and date stamp of when it was entered.


I hope this is a little clearer and easy for you to understand what I'm trying to do and I apologise if I have been unclear in the past.


Thanks

Owen

You haven't actually described a problem or asked a question. So:


— What platform, macOS or iOS?


— Are you stuck at creating the table view itself? Or at populating the rows? Or at designing the structure of the columns within the rows? Or at implementing that design?


— It's not obvious how you expect to use a stepped to "increment" column heading values, or even what that means, really. A heading is a heading. It may contain a numeric component that increments in value across the columns (e.g.), but a stepper is a UI element that allows a user to choose a number from a range of numbers.


Keep in mind that macOS table views have an explicit concept of a table column, while iOS does not. Either way, you should be able to approach a solution to your problem incrementally. Start with simple rows, and add information (and UI elements) horizontally for each of the structural pieces that you want for columns. There's no particular advantage in trying to implement all the details at once.

I'm sorry, I thought it tagged the swift bit on the post. I am trying to develop this in swift, perhaps it would be easier if I attach a picture of a sketch I did showing the app. I don't really know where to start to be honest, see if this sketch makes any more sense, if not I can try to explain it in a different way.

Sketch: http://pasteboard.co/5HWCws4fs.png

Thanks

Owen

Again, it's still unclear what kind of assistance you're looking for. People here are happy to answer specific questions, but if you're having trouble getting started, it's not really practical for anyone to jump in and write code for you.


Based on the shape of the "screen" in your image, it looks like this is an iPhone app, so you'd be using UITableView, not NSTableView (the Mac equivalent). With UITableView, there are no columns as such, only rows. To get an arrangement like your screen with the steppers, each row (cell) would have a cell view that uses autolayout to position the subelements — text label to the left, stepper and text file to the right. It'll look like columns, even though there aren't really any columns.


Have you tried starting from an iOS "master/detail" template, which you can choose when creating a new project in Xcode? This should have a similar general structure to the kind of app you seem to be wanting, and you can customize your rows using that template as a starting point.

Ok thank you, I realise I must be more specific on this forum to get effective help, thank you 🙂

Owen

How to read and write to a table?
 
 
Q