how can I customize the DeatiledView of a table View in swift based on what cell the user clicks on? I already have the new class set up with text, but not sure how to make the if statement that customizes the text for each cell clicked. Please let me know if you can help, Thanks!
Look at the View Controller Programming Guide, particularly "Configuring the Destination Controller When a Segue is Triggered" in section "Coordinating Efforts Between View Controllers".
It is a very basic question - not really suitable for this platform. You should at least read the documentation.
Related
I am new to all of this, so please excuse if there is an obvious answer to my question.
I have a native tvOS application which incorporates a CollectionViewController very similar to that, which Apple uses in their UIKitCatalog.
I have set everything up programmatically, as I am not looking for a storyboard based answer. By default a user can interact with the cell, that is in focus, but how exactly would I achieve that by clicking a cell you are forwarded to a different view controller. I know how to do this with a Button and an IBAction, but I would like the cell to act as a button in this case, so how should I do this?
Thank you for your answers!
Regards Paul
You can achieve this by using UICollectionViewDelegate collectionView:didSelectItemAtIndexPath: i guess you can performSegue
https://developer.apple.com/library/tvos/documentation/UIKit/Reference/UICollectionViewDelegate_protocol/index.html#//apple_ref/occ/intfm/UICollectionViewDelegate/collectionView:didSelectItemAtIndexPath:
I am very new to swift coding. That being said, I'm looking to transition from a "home page" to a tableview or new view controller once a menu item has been selected. I am just curious how I would go about using one view controller/tableview but loading the contents from an inherited file based on the selection made previous.
Example:
HOME - Chores at home
- Chores at work
- Chores at school
A selection of chores at home is selected, then only one segue that is prepared loads the only view controller downstream in Xcode, but loads the content differently then if they had selected chores at work. Hope that makes sense and thank you very much in advance. If I am not mistaken, this would be considered subclasses a UIViewcontroller or UItableview???
You may Only needs to see UITableView Docs, you can set different datasource depends on your selection
This is Apple link for docs
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/
And here is simple tutorial to follow
http://www.codingexplorer.com/getting-started-uitableview-swift/
Im new to iOS development, and Im developing an app the uses a lot of UITableViews. I am having a hard time wrapping my head around how Im going to accomplish this app.
I am going to have the user be able to add cells to a table view, and for each cell, I need a UIViewController (this view controller will look the EXACTLY same for every cell) that will save data.
So my question is how can i write the code to create a view that only cooperates with one cell, but has the same interface for all the other cells? (The view im talking about is when the user drills down on a cell, it allows them to input some data).
Every "drilled down view" is the same, but they all must work uniquely with the cells of the table! I am having such a difficult time with this one, and any help would be greatly appreciated, if anyone knows of a tutorial I can check out, that'd be great! Thanks again!
Generally you would, if at all possible, have two view controllers, your table view controller and your detail view controller. You'll often hear this described as a "master-detail" (the table view controller being the "master"). Your table view controller will, when someone selects an item from the tableview, trigger a detail view controller, passing it the necessary information.
You would only consider different detail view controllers (what you call the "drilled down view") if the nature of the view is structurally different from each other. Thus, you would have one detail view controller for each "type" of detail view, and you'd just pass it the necessary information to present the appropriate details. You haven't provided enough detail in your question to let us ascertain whether one detail view controller would be sufficient, whether you'd need a few, or whether you really need unique detail view controllers.
For more information on view controllers, I'd suggest you go through the ViewController Programming Guide as a more detailed discussion of how to construct master-detail apps is probably beyond the scope of this forum. You can probably also google "iOS master detail tutorial" and get tons of hits.
From What I understand based on what I read, most of the time we will be dealing with view when creating apps for the iPhone. Adding sub view to table view, adding table view to a UIView....etc
So my question is how do I go about mix and match all the views? Let say I start off by using a template in Xcode (Tab Bar Application) which basically give me 2 "section", a tab bar controller with 2 UIView to began with. I modified the code for the UIView so that I end up with 2 table view. Now I wanted to an add additional view to the table view whenever I tap on a cell on the table view. I create a new view controller call firstDetailView and hook them up but nothing happen. Surprisingly the app doesn't crash.
I might do it wrongly or have missed something. I am a newbies to programming. Any help would be appreciated.
Thanks.
If you want to deal with different views which are handled by a view controller you should read the View Controller Programming Guide
Navigation through views will be done with a Navigation Controller (Guide here)
Tab bar's are explained as well (Guide here)
Try to read the Apple documentation in the first hand, they are pretty good and all basic stuff is explained there.
I have seen this question posted several times with no useful answers. I am trying to place a toolbar above my UIKeyboard in my iPhone app, but am having difficulty. I found this example which works GREAT, except that my view is a UITableView instead of the standard [self.view addsubview:...]. Can anyone figure out how to apply this to a UITableView?
In short, I have several UITextFields in my table cells, so I want the toolbar to appear above the keyboard for those cells.
Many thanks,
Brett
Just don't use the table view directly as a view.
Use a view that will have a table view inside it.
This way you will be able to use the tutorial as is...
In my opinion this way is much better - I don't have view controller with a single table view in any of my applications. There is always something additional on the screen...
In addition, I don't think that using parentViewController is good solution.
Not always you have one.
Actually, I don't even understand how it works for you...
A work around for this would be to create a hidden textfield in a viewcontroller and present it modally with it begin the first responder. The view can be completely transparent and the toolbar can be configured using the interface builder.