Customizing all table views in app using iOS 5 - iphone

Perhaps I'm searching for the wrong keywords, but I'm surprised there wasn't already a similar question. If there is, please let me know and I'll delete this question.
What's the best way to customize all table views in an app targeted for iOS 5 or later?
UIAppearance has proved to be very useful for customizing all navigation bars, tab bars, and the like throughout an app. Is there a similar way to customize table view and table view cells?
So far I've been programmatically configuring each table view separately. This might not be the best idea as I plan to have different themes the user can select. I've been thinking about creating a separate class that returns the appropriate image for the table view (or cell) based on the theme the user has selected. Would this be a suitable approach (if there's nowhere to easily customize all the table views)?

The most used way to customise table views is through defining table cells in the nib files:
http://www.galloway.me.uk/tutorials/custom-uitableviewcell/
or storyboards:
custom uitableviewcells in storyboard
I haven't do any tweaks by appearance class yet, but it may be helpful. If you want to to this programatically, use the decorator pattern to ease your and further user's life in joining produced code into the project:
http://sourcemaking.com/design_patterns/decorator
I hope this is helpful

Related

How to create grid table view in iphone

Hello I want to create a table view like as following image
There is any library is available. how can create like this.
Check this repository GridTableView. I used the same code to create 10 columns in iPad application. Let me know your thoughts.
I recommend to use UICollectionView and PSTCollectionView
or
You can use the UITableView for this and with your own custom cell which it is not complicated.
Note:
UICollectionView is only Available in iOS 6.0 and later.
The UICollectionView class manages an ordered collection of data items and presents them using customizable layouts. Collection views provide the same general function as table views except that a collection view is able to support more than just single-column layouts. Collection views support customizable layouts that can be used to implement multi-column grids, tiled layouts, circular layouts, and many more. You can even change the layout of a collection view dynamically if you want.

Does storyboard eliminate the need for .nib

With the introduction of storyboard, I wouldn't select to create a .xib/.nib when I create a subclass of UIViewController, because I can just drag out a viewcontroller in interface builder and assign it to the new class.
So, with storyboard, when would i need to use the .xib/.nib file?
Thank you.
Storyboards don't completely remove the need for NIB files. One common example is when creating subviews to go inside a UIScrollView. You can't create the subviews separately in a storyboard; instead you have to create separate NIB(s) for the subviews and attach them to the scroll view programatically.
In fact, on almost any occasion where you have a need for subviews which change at runtime you'll want to use separate NIBs.
Storyboards are great for certain kinds of apps, but for anything even remotely complicated the old way works very well still. An additional benefit is that they co-exist nicely. You can put placeholder views in your storyboard and fill them programatically with NIB-defined views later on.
I guess, storyboard contains the .xib/.nib files for all your views. It present relationships between them and helps you to avoid confusion if you have a LOT of views. Also it saves your time and nerves when writing code.
I have tried out storyboarding lately and I do have mixed feelings about its use:
Pro's
Convenience: You might have to write much less code. So you can for example show a static view without having to write any code.
Overview: You can quickly see how the ViewControllers relate to each other
Efficiency: For the simple use cases I find the Storyboarding much more efficient than "the old way".
Example 1: Editor > Embed In > Navigation Controller and voilà, no more instantiating and configuring is required.
Example 2: You can make "Prototype Cells" for TableView which speeds up the creation of static table views dramatically. AFAIK this is not possible with nib files
It's cool :-)
Con's
I find that the re-usability somehow suffers with storyboards. Although I can segue to a given ViewController from multiple points, it is still limited since in one case I might use the VC as a Popover and in another as a Master-ViewController.
Assuming that you are working in a big team and different people are changing different parts of your application, having one monolithic storyboard which you then have to merge might pose a big problem team-work-wise.
I really would like to have some mechanism to include or reference existing nib files into the storyboard which is currently not possible.
So considering these points I still find storyboarding very appealing but it makes sense to combine both approaches which is not really a big deal. Additionally, this technology it is still quite new so it might improve in the (near) future.
If you use storyboards, you generally won't need to create separate .xib files. You can still use a .xib file if you want to -- it might be useful e.g. if you have a particularly complex view that you'd like to configure by itself. Most of the time, though, there won't be a need to do that.

Is "setting" UI implemented by table view in iphone/touch/ipad?

I want my app's setting UI feel consistent with iphone's internal setting UI. It looks like it's implemented by a table view with sections to group the setting items together. Am I correct?
refer to: http://i.stack.imgur.com/XNVyO.png
Is it implemented by a table view with hard coded cells and sections or is it build by interface builder? If it is built by IB, how to design the sections?
thanks
-Leo
you might want to look at something like InAppSettingsKit, an open source framework that duplicates the settings app feel in your application.
if you want to create it yourself you'd just set the ui table view style to UITableViewStyleGrouped
Read up about how UITableView Work, You will need a UITableViewDataSource.
The datasource tells the table how many sections and cells there are in the table view.
Then the UITableViewDelegate will handle any selecte rows:
http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/TableView/TableView.html

Custom tab bars, table views, etc

this is my first question here at Stack Overflow.
I've been looking for a way to do this ever since I started programming for iOS (which was really not that long ago, about a month) but I haven't been able to find any concrete explanation, so I decided to ask you.
I've seen many apps that have custom artwork in them (e.g. wooden textures, backgrounds with noise, custom table view cells, etc.) and I would like to add some to my own apps, are there any properties that I can access, say for example, on a tab bar?
Check out Wunderlist or ReadMore, these two are great examples of what I mean.
Wunderlist was made using Titanium, obviously editing backgrounds and customizing table view cells and table view backgrounds is easier in JavaScript, but if Titanium has a way of doing it then there must be a way of doing it natively in Objective-C, right?
Thank you in advance, your help is very much appreciated.
There are a number of ways to create a custom UITableView and associated cells.
As a general overview, the Cocoa with Love Easy custom UITableView drawing blog post is pretty good and there's also a more recent (and complex) UITableView construction, drawing and management (revisited) post on the same site if you really want to go for it on the customisation front.
there a few ways of customizing UITabelViewCells.
Table View Programming Guide for iOS
Interessting Chapters:
Programmatically Adding Subviews to a Cell’s Content View
Loading Custom Table-View Cells From Nib Files
Subclassing UITableViewCell

iPhone app - some custom UITableViewCell questions

At the moment, I have a settings view in my iPhone app built with Interface builder, it consists of a background image, some text fields, labels and buttons. Because this looks bad, I want to convert the settings view to an UITableView with custom UITableViewCells.
I already tried adding some cells into my settings view's XIB and returning them in the cellForRowAtIndexPath method (with [return myCell];), as written in Apple's tutorial, but this was not working for me - my whole TableView looked strange and it only showed the first cell correctly.
Is it possible to design these custom cells in Interface Builder? Do I have to create an empty XIB for them or can I put them in my view's XIB? And how do I insert them into my TableView?
Thanks in advance,
Yassin
You can absolutely add custom table cells that you built in interface builder. This includes both static cells and Dynamic cells. However without you providing more information the best I can say is "double check the docs and try again." I can only say that it works and it's rather straightforward so it's hard to say what you may have missed. It might be more helpful if you post what you have for the tableView:cellForRowAtIndexPath method.
Since you say you just have some text fields, I would recommend looking at the technique for static row content section of the Table View Programming guide. You probably would want to have each field of your form correspond to a row in a Segmented Table View, it'll make everything look nicer.