I have a UITableView with 3 sections inside of a UIViewController. Is it possible to have other controls above the UITableView for example a UISlider or a UIImage? If so, how can this be accomplished?
Note: These controls should not be in a UITableViewCell, they should be part of the view.
Yes, you can add a UIView to the table header or footer, see the tableHeaderView and tableFooterView properties. A UIView could be a UIControl or a view that contains UIControls.
Related
I am looking for a third party library that would allow me to use a UIScrollView with a UITableView mechanism, so it will have something like viewForRowAtIndexPath, numberOfRowsAtIndexPath.. reusing views. I know a UITableView is a subclass of UIScrollView, but I want to do more customization that will be kind of hard when using UITableView.
Since UITableViewCell is a subclass of UIView, you could use a custom UITableViewCell, adding your view as the UITableViewCell's subview. I am assuming that all your views are of the same size. (In the table view controller's init method, remember to set self.tableView.rowHeight to a value that will accommodate the heights of your views.)
See the Customizing Cells section of Apple's Table View Programming Guide for iOS for more info.
How does the table view appear with rounded corners (as shown below)?
I would appreciate any sample code or may be some tutorial for having the table look rounded in the corners. Each section title also appears different from the conventional way..
It is a UITableViewStyleGrouped you can initialize it with:
- (id)initWithFrame:(CGRect)frame style:UITableViewStyleGrouped
You can implement datasource and delegate methods for UITableView and take Custom UITableView cell which has UITextField or add UITextField as sub view in cell's contentView
I have in the Interface builder a view which contain a UITableView and a custom UITableVIewCell, I would like to add an image view to my view. How I can do this? I have added an image view, but the cell of my table view have a strange color.
you need to make your cells and table view transparent
Add UIImageView to your XIB file and set its IBOutlet.
Now add UITableView to your XIB file on UIImageView and also set its IBOutlet..
Make UITableView's backgroundColor to clearcolor...
Hope this will work...
I created an application using a UITableview.
But when I scroll the table view, I see a white space view before and after the table view. How can I fit the UITableview so it doesn't show that empty view?
Here's an image of what happens when I scroll the UITableview.
Set the bounces property of the UITableView to FALSE.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html%23//apple_ref/occ/cl/UIScrollView
(UITableView inherits from UIScrollView)
The answer is...
tableView.bounces=FALSE;
Can you place more than one image in a UITableViewCell?
Yes.
You can have 2 images per cell, without customizing.
imageView
accessoryView
You can also add images to the contentView.
The standard UITableViewCell only supports one image (via the imageView.image property).
However, you can make a custom subclass of UITableViewCell and add the desired number of image views.
The simplest way would be to set a custom view (with any number of images) as the cell's contentView.
You could create a custom view and set it as the cell's contentView property. AppleĀ“s Table View Programming Guide for iPhone OS explains in good detail possible strategies for customization of an UITableViewCell.