Reputation: 747
I have a Table View Controller that displays information using JSON. I want to change the styling of my app, and I don't want it to have that "table" view that it has now. Whats the easiest way to change my Table View Controller to a regular View Controller, the biggest problem I have is that the code uses a tableView and I dont know how to get it to work as a regular view controller.
I using a Storyboard with a TableViewController thats linked to a controller called UpcomingReleasesViewController.
I want my app:
To look like this:
Upvotes: 1
Views: 1685
Reputation: 437532
My original answer was assuming you just wanted to convert from a UITableViewController
to a UIViewController
. Looking at your screen snapshots, I infer you really want to switch from a UITableViewController
to a UICollectionViewController
(which is an iOS 6 feature than allows you to do precisely what you want).
In that case, change your base class to UICollectionViewController
, and replace your UITableViewDataSource
methods with UICollectionViewDataSource
methods. And then redesign your scene using a Collection View Controller.
See the Collection View Programming Guide for more information. Or see WWDC 2012 sessions Introducing Collection Views or Advanced Collection Views and Building Custom Layouts.
If you need to support iOS versions prior to 6, then you have to do this collection view style coding yourself manually, putting your image views on a scroll view and using a standard UIViewController
. It require more effort than using a collection view, but can be done.
Original answer:
If this view controller will have a table view on it, but you just want to add more controls to the scene? If so, just change the view controller's base class from UITableViewController
to UIViewController
, create the new scene, add a table view to it, and specify the table view's delegate and data source to be the view controller:
Also, make sure you define an IBOutlet
for your table view (and if you call it tableView
, that will minimize any coding changes needed).
If you do that, you can quickly convert a UITableViewController
based controller to a UIViewController
with minimal code changes.
Upvotes: 4
Reputation: 3271
If you're looking to make something like your new UI mockup, look into UICollectionView. You'll see many of the same concepts (i.e. dataSource, delegate method signatures are similar) that are used in UITableViews used in the collectionView API.
Upvotes: 0