I would like to display the results (reports) after a series of operations on the iOS app.The result format is commonplace and is outlined in
----------------------- (abbreviated below)
Basic Information
Username: ~
When: ~
Overall score: 90 points
Graph
View Graph Here
US>Detailed Results
Show UICollectionView here
--------------------- (above)
It's like .Each content is generated by a program, not fixed.
Here's what we considered:
WebView Used in previous versions.Create a base HTML and dynamically replace the string where you want to change it and give it to UIWebView.It worked correctly, but I want to use a library such as iOS-Charts, so I am looking for a way to make it with iOS features such as UIKit.I used to draw graphs and stuff in JavaScript libraries.
Auto Layout Paste the UIScrollView, place the UITextField in it, and locate it with auto layout.I think I can do what I can, but I think it's really hard.Also, I think it is not flexible.For example, if you put a bar graph on the graph and you want to add a pie chart, you will have to re-layout it again.
UISTackView
I think it takes less time than auto layout, but I am investigating it.
AddSubView to UITextView
The fixed text attributes can be determined by the storyboard, but it takes a lot of time to lay out the subview.
Expectations are, for example,
reportView.addSection("Basic Information")
reportView.addItem("username:\(userName)"
reportView.addItem("Date:\(date)"
...
reportView.addSection("graph")
let barChartView = BarChartView(...)
barChartView.data=....
reportView.addView (barChartView)
reportView.addSection("Detailed Results")
reportView.addView(detailedView)
If you add them as shown in , they will be added to the end in the order in which they are executed and laid out properly.This is an image, so it doesn't have to be like this.It would be helpful if the report (document) could be completed if you could tell the view the necessary items one by one.Markup languages such as HTML and LaTeX are suitable.Also, I don't have a sense of design, so I think the size of the headline will look better if it is made beautifully on the framework side instead of adjusting it in detail.
I would appreciate it if you could let me know if there are any standard or external frameworks or libraries that meet these needs.I think displaying reports is a relatively common feature, but I couldn't find them even though I looked them up in Japanese and English.
Thank you for your cooperation.
ios swift objective-c
Is the number of items displayed really variable?
After laying out the prototype on the storyboard or xib, if the number of items seems to be fixed, I recommend using AutoLayout.
As a way to do this, if you lay out the items that can be expressed in characters in NSLabel and set the font size in Inspector, you don't have to worry about the size of the characters when generating the report.
Also, regarding multiple graphs, this one also has layout constraint as an outlet and can be changed from the program at any time, whether it is width or height, with the outlet variable .constrain.
If you lay out the entire graph as View and paste the UIImage image into the View, it will be easy to achieve even if the number of graphs increases.
By using the above method, the layout is decided in advance, and the coding focuses on generating the contents, so the contents can be separated from the layout, and the code will be refreshed.
Therefore, I think it would be better to add the contents in .setText() to the UILabel that was laid out in advance.
© 2024 OneMinuteCode. All rights reserved.