PTPopoverTableViewController
@interface PTPopoverTableViewController
: UIViewController <UITableViewDelegate, UITableViewDataSource>
A UITableViewController
replacement designed to work well in a popover presentation.
Functionality replicated from UITableViewController
includes:
- Creates a table view with the correct dimensions and autoresizing, setting the
dataSource
anddelegate
to self. - In
-viewWillAppear:
, it reloads the table’s data if it’s empty. Otherwise, it deselects all rows (with or without animation) if clearsSelectionOnViewWillAppear is YES. - In
-viewDidAppear:
, it flashes the table’s scroll indicators. - Implements
-setEditing:animated:
to toggle the editing state of the table view. - Sets the
preferredContentSize
to reflect thecontentSize
andcontentInset
of the table view.
Unlike the UITableViewController
class, this view controller class does NOT adjust the contentInset
of the table view when the virtual keyboard is shown.
-
Initializes a
PTPopoverTableViewController
instance with the specified table view style.Declaration
Objective-C
- (nonnull instancetype)initWithStyle:(UITableViewStyle)style;
Swift
init(style: UITableView.Style)
Parameters
style
The style to use for the table view
Return Value
an initialized
PTPopoverTableViewController
instance -
Initializes a
PTPopoverTableViewController
instance with the specified coder.Declaration
Objective-C
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)coder;
Swift
init?(coder: NSCoder)
Parameters
coder
The coder for initialization
Return Value
an initialized
PTPopoverTableViewController
instance, ornil
if decoding failed -
The table view used by this view controller.
Declaration
Objective-C
@property (nonatomic, strong, null_resettable) UITableView *tableView;
Swift
var tableView: UITableView! { get set }
-
Whether the table view’s selection should be cleared when
-viewWillAppear:
is called.The default value of this property is
YES
.Declaration
Objective-C
@property (nonatomic) BOOL clearsSelectionOnViewWillAppear;
Swift
var clearsSelectionOnViewWillAppear: Bool { get set }
-
Undocumented
Declaration
Objective-C
- (instancetype)initWithNibName:(nullable NSString *)nibName bundle:(nullable NSBundle *)nibBundle NS_UNAVAILABLE;