i am working on an app that lets the user enter some information which then gets loaded online. As part of my project, i want the user to enter some information and it would be alot easier for them if there was a table allowing them to enter it , ok so the problem is, I have a view controller with a scrollview which gives me some more space i can work with.
I want a way where i can display a table 5 columns across and the rows will depend upon the user, the table should only take a small amount of space on the scrollview, the table will allow information to be entered into the cell which later will be saved. i just need a point in the right direction on how to go about this problem. I am fairly new to swift and any guidance would be much appreciated, thanks in advance
Based on your requirement of having both columns and rows—I would look into creating a UICollectionView and populating the cells with UITextFields.
Please learn about UITableviewController here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewController_Class/
There are no columns, just rows, and you don't need an extra scrollview to contain your tableview in. There are plenty of tutorials out there that teach how to work with table view controllers. You should seek guidance here if you have a particular problem with implementing them.
Related
In lots of apps that have a feed every now and then the users are presented ads. I am assuming these adds are placed in their own cells of a UICollectionViewController. How does one add such ads to ones app in a randomly inserted cell between two existing cells without replacing either of them?
I have found a solution. Its not pretty but here it goes:
I have changed the height of every 5th cell to have space for implementing ads. Therefore I am not overwriting an already existing cell only populating an already existing cell with more data.
Once I have found a better solution I will let you know but this is it for now, if anyone comes across the same problem
This is going to be a bit difficult to explain. I'm usually fine with code on the micro level, but need some guidance on the macro end. Anything would help.
I'm trying to basically create a notecard application, where the user is presented with a screen with a stack of flashcards. There are multiple subjects, each managed by a different .plist. To switch between subject areas, you swipe left and right. I don't know how to most efficiently achieve this using storyboards, which is my primary issue. Could you do this using one view, or do I have to create a different view for every stack of flashcards and create a transition between them?
Thank you very much, in advance.
If you are looking to switch between different views by either swiping left of right, the most logical choice would be to use a UIScrollView with paging enabled. You could then initialize an NSArray and have it store the names of your different PList files and use it to manage your data between views. Obviously this is just one of many solutions to this problems, but when you talk about wanting a swiping action to switch, UIScrollViews would be the iOS default way of doing it.
Here is a tutorial on how to use UIScrollViews with paging:
http://www.iosdevnotes.com/2011/03/uiscrollview-paging/
Hope that helps!
So, I'm a bit of a noob to iOS (PHP dev). I have a UITableView in a UIViewController. The cells consist of a combination of any of three different custom prototype cells. Which cells are loaded is based on a service that loads the questions and types. One has a segmented control with 2 choices, another with 8 choices and the third has a UITextView to receive a comment. This is essentially a survey. I can grab the values of the controls as they are answered, but I'd like to be able to just gather them up when the 'submitResponses()' method is called as an action attached to the 'Submit' button.
Any ideas? Should I be going about this in another way?
The "correct" way to do this is definitely to collect the data as it is entered!
One of the biggest problems with the approach that you suggest is that for larger tables it simply won't work because if a table view cell is off the screen, you can't access it or the controls/views that it contains (and it may not even exist yet!).
I would like to build a table that looks almost exactly as the one in the iPhone's contacts app. When you click on a contact it shows the information related. The biggest problem comes when I try to build that: a table with complex cells, with transparent cells and cell with two buttons.
How would you do that?
Thanks!
You'll want to study the Table View Programming Guide, which will walk you through the various pieces of this. Along with that, you should study the sample code in TableViewSuite. This sample code includes a series of five examples of increasing complexity.
I'm not certain what you mean by "transparent cells" however. There aren't any transparent cells in Contacts. What you are probably referring to is called a grouped table, and you will learn about that in the Programming Guide.
I suggest you review the article on Cocoa with Love on drawing custom UITableViewCells as a starting point.
If the "transparent cell" you are referring to is the top section of the Contact Info page that displays the contact's picture and name, then this tutorial might help you. It is possible to insert custom header and footer views above and below each section of a table. That tutorial details how to add a header view to the first table section to display a picture and a label just like in the Contacts app.
In reference to my previous question, I would like to know how to implement a large grid of cells in an iPhone application.
I'm working on an interface which would be similar to an Excel spreadsheet, with many rows and columns. Do I have to handle each cell separately? How can I handle user interaction in each cell?
Is there a standard way to create this type of control?
There is no real standard mechanism.
If all of the cells in a given row will always fit in the width of the screen, one way to do it would be to create a UITableViewCell with several UILabels and vertical separators between them. If all of these rows had "columns" of the same width, you would get the appearance of a grid.
If that isn't possible, it might be helpful to think about what the table view control truly is. A table view is just a scroll view that automatically adds, removes, and recycles its subviews so that only the ones that are visible at a given time are in memory. There is no reason you could not write a GridView control that did the same thing, but in two dimensions. It wouldn't be as easy as using the built-in table view, of course, but if the table view can't do what you need, well, that's why Apple isn't writing all the apps.
Sounds like the exact thing that UICollectionView was made for!
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UICollectionView_class/Reference/Reference.html
Look at my answer to this question: MS Excel type spreadsheet creation using objective-c for iOS app.
Basically there's no standard way to do this. You will need to made everything by hand and there's 3 ways to go:
Use a UIWebView and layout everything using html/js.
Modify a UICollectionView.
Make everything by hand using Core Data.