How to use static cells in UITableView without using Storyboards?
Static table view cells are only available when using storyboards. However, if you aren't using storyboards for your entire UI you can still use them for individual screens instead of a collection of screens.
To do this you can create a UIStoryboard file with a single view controller on it that has it's File's Owner set to your custom view controller subclass. Set the VC's identifier to some value. When you want to display this, get the storyboard and then instantiate your view controller subclass by creating the VC from your storyboard.
UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"your storyboard" bundle:nil];
CustomViewController = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"custom identifier"];
You can present this VC as usual in your app.
This is a great way to start using storyboards without having to convert your entire app to use them.
UITableView with static cells without cellForRowAtIndexPath. How to set clear background?
I'm not entirely sure if this will work, because I've never tried using super
to manage the cells. If your code works with super
, then you should be able to get away with doing this to set the background color:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor = [UIColor clearColor];
return cell;
}
Either way, this seems to me like a strange way of doing things. Normally the cells are created and reused in the method itself, as per the default UITableView
boiletplate code, without calling super
.
Content of static cells not appearing UITableView
I think you have problem with constraints! If you have wrong constraint for elements inside cell, elements will not shown!
How to visually create and use static cells in a UITableView embedded in a UIViewController
You are right. In storyboard, you cannot have a tableView with static cells embedded in a viewController. One way around it (I have not tried it myself, though, so I am not sure if it works) can be that you create an instance of UITableViewController in storyboard with static cells. Add an instance of UIView to your viewController, and then programmatically load the tableView of the UITableViewController into the UIView of your viewController.
How to set a static UITableview on xib?
It isn't possible with xibs. If you want to use static cells in your UITableView, you'll have to use storyboard.
Static Grouped UITableView without storyboard
No, you can't. tableView:cellForRowAtIndexPath: is the way a table gets its data -- there's no way to populate a table without that in iOS (in OSX you can use bindings, but they're not available in iOS).
If you only need a few cells, are you sure you need to use a table?
UITableView with static cells does not appear
Do you want to try using the TableViewController rather than the Generic View controller ?
Related Topics
Remove Space Navigationtitle But Not the Back Button
Show iPhone Cut Copy Paste Menu on Uilabel
iOS 6 - Viewdidunload Migrate to Didreceivememorywarning
Setneedslayout and Setneedsdisplay
Getting Text from Image on iOS (Image Processing)
Warning: Attempt to Present * on * Whose View Is Not in the Window Hierarchy - Swift
Trouble with Autolayout on Uitableviewcell
How to Save Nsmutablearray in Nsuserdefaults
Linking Objective-C Categories in a Static Library
How to Hide Tab Bar with Animation in iOS
How to Set the Full Width of Separator in Uitableview
How to Dismiss Keyboard iOS Programmatically When Pressing Return
Simply Mask a Uiview with a Rectangle
How to Dismiss a Storyboard Popover
Could Not Find an Overload for "Init" That Accepts the Supplied Arguments in Swift
Swift Uicolor Initializer - Compiler Error Only When Targeting Iphone5S