IOS Storyboard Flow and UITableView Reuse - ios

Newer to IOS developent and I'm wondering what the best way would be to transition between views in the storyboard with dynamic editable content that has the exact same UITableView the only difference is the header/title.
It's kind of like a multi-page form but all the questions are the same just the page/title changes.
I'm thinking I reuse the UITableView for each set of questions but I'd like it to swipe from question set to question set. I could use a push back to itself?
(I'm also trying to attempt it in swift)
Hopefully that makes sense.
Thanks for any help.

Related

How to create a table in swift with segue?

I'm brand new to Swift but I want to create an app that has a table and each entry in that table will lead to a new screen (but this new screen is the same for all the table entries) but depending on which table cell you click on, that screen has different information posted on it.
What are the steps I need to do to complete this? I have my story board I'm just not sure how to put this all together with code
Thanks in advance!
Well your question is very broad and not very specific. Therefore it is not easy to give a helpful answer. What I would do:
Create a UITableViewController that holds your "table".
Define a UITableViewControllerDelegate for the UITableView that will be informed about UserInteractions (especially when the user
didSelect a certain row of the table).
Based on the specific row (that was selected) you can create a second UIViewController class the shows your intended information.
I can not show some code samples because your question is to broad and things depend on a lot of things (especially on the kind of data you want to show) and how you implement your UIElements on the ViewControllers in InterfaceBuilder.
And if you are not yet familiar with the concept of a UITableViewController and its Delegate, than you should find some tutorials first about that basic technique in developing iOS apps.
You want to use the master/detail pattern. I suggest doing a search on that.

Which Controller is Used in App?

i am starting a new project based upon some Sketch design. It has following two designs: this and this so my question is how to accomplish this effect, which UIViewController is used here, is there some code example similar to this?
They are both most likely using either a UITableview or UICollectionView.
The cells are customised with what looks like a clear background and shadows all over the place.
They should be fairly straight forward to do. Just very unusual in that you'll have to set a clear background on the cell and add views for the data/images etc...

Storyboard of a mockup

I am working on an e-commerce based app, and the designer has passed on the mockup to me. !
This is the mockup the designer has passed.
I am working on storyboard of this mockup and I have managed to get to this level as of now.
There are several views and features which cannot be included in this storyboard now because of the limited space. I know the designer has passed on me the rendered view, which can be seen on scrolling the app.
I wonder which could be the best approach to include all these views in a single storyboard or render them in a single view.
I have looked onto using xib files and calling them from my viewcontroller class, which could be a possible solution. But, I want to know, what could be the best solution?
Best solution is use Storyboard so that you have all screens at one place. But keep one thing in mind that start doing the whole project in XCODE 8 storyboard (Because XCODE 7 and 8 storyboards are not fully compatible with each other). So that you get compatibility with previous iOS versions also (< iOS 10)
Now as far as design is concerned, I would like to suggest you use autolayouts and proportional layout.
your View controller will always have self.view. Start on that view. First add navigation controller (with root view controller as your first prefered view controller on app start) or simply add one toolbar. Then add one UIScrollView to whole remaining space. Then start with your design inside UIScrollView. Don't forget to provide contentSize of UIScrollView.
For any help, feel free to ask.
The best solution would be using a tableView with multiple prototype cells for this kind of problem. Well, going through the concept as mentioned, I could easily scroll in the storyboard and maintain my design as per the mockup.

iOS UIButton or Single Row UITableView For Dropdown Like Thing?

For iOS 7 and iOS 8, we're implementing these things that look like drop-downs, but each just launch a modal window.
What makes more sense, using 3 UIButtons, 3 UITableViews with 1 row, or something else? In the past, there would be more than one of these all lined up, so I would put them in a UITableView and set the accessoryView of the UITableViewCell. Using the cell was nice, but three UITableViews seem like overkill here and a maintenance hassel.
The closest post I found regarding this was one about using an UITableViewCell outside of UITableView
What would make the most sense is to follow the iOS design guidelines. Instead of trying to create custom dropdown menus (or worse: showing a drop down menu, but displaying a modal view when the user is expecting a drop down view), that UI could be replaced with 1 UITableView that has 3 UITableViewCells in it. The text on each cell would be the name of the setting to be changed and selecting the cell would push segue to the next page. This will give the app a uniform iOS UX; allowing users to know exactly how to use your app because it works similarly to other apps on their phone. Check out the Settings app on the simulator to see what I am describing.
I don't see any advantage to using a UITableView or a UITableViewCell. I think this is clearly a case for three UIButtons. You can set constraints to keep them nice and clean. One cool thing that might be worth investigating is using a unicode character for the downward arrow. That way you could have the tap feedback on the whole "thing" as you called it.
When I need to create sort of dropdown menus, I usually take advantages from UITableView, one above all is when you will need to add one or more selections in the dropdown you just need to change the data model.
UITableViewCells are easily customizable that means that you can create almost everything you want.
I think that your design doesn't adapt well to a mobile application, those kind of menu are more web style, with 3 buttons and a UIPickerView you can really improve the user experience and also adapt in a really easy way on the ipad embedding the picker in a UIPopoverController.
as i agree with #keithbhunter, but still if you want then may this links will help you.
http://code4app.net/ios/DXPopover/54741ca3e24741c56db03ca0
https://www.cocoacontrols.com/controls/kxmenu
https://www.cocoacontrols.com/controls/nidropdown

iOS Universal App - UITableView/UICollectionView

I'm trying to develop a universal iOS app and ideally I'm trying to get as much code re-use as possible.
I'm using storyboards so the UI is segmented into scenes.
In the iPhone storyboard the particular scene in question is best suited to a table view.
In the iPad storyboard, the equivalent scene in the storyboard would ideally implement a UICollectionView and so render the content in a grid.
Both views should implement a pull-to-refresh control which in one case is going to call a [UITableView reloadData] and in the other a [UICollectionView reloadData].
Anybody any advice on how to get the maximum amount of code re-use, ie. what does the controller class look like?
1 option would be to have 1 monolithic class that conforms to both the UITableView protocols and the UICollectionView protocols but this doesn't feel right.
Another option would be to have a base class and then subclass it with specialisations for iPhone and iPad. Whilst this feels cleaner, I'm still thinking there might be a better way. In my first attempt at this it felt like there was more code in the specialisation classes than there was in the base class.
The third plan I've considered is simply to use a UICollectionView in both apps therefore eliminating the complexity of the controller. Hopefully I could force the layout of the collection view to be a grid on the iPad whilst tell it to mimic a table view on the iPhone.
Whilst on the face of it this sounds easy I'm struggling to make a UICollectionView work exactly like a table view would do normally.
Any advice guys?
Many thanks,
CA.
If you are not using some of the specific UITableView features[1], making UICollectionView look exactly like a table is trivial. I think I would go for using UICollectionView as it will allow more flexibility in the future and you will have to use it anyways.
When you are talking about code reuse you probably mean the DRY principle. It just says you should not write the same code or the same information twice, but I don't think this is your main issue here.
I would use a UITableViewController on the iPhone and a UICollectionViewController on the iPad. I think this is the cleanest and easiest way to go. What exactly do you hope to reuse among both controllers? The both require two different delegate protocols, so most of the methods will be specific to one platform. You will need two NSFetchedResultsController if you're using Core Data, but reusing the fetched results controller code only makes sense if you need the same data on both platforms.
If you create a new universal project in Xcode you will get a basic project setup that looks different on iPhone and iPad. Try to understand it (there are some details to pay attention to) before you start programming, I think it will answer at least some of your questions.

Resources