How to create UITableViewCell with an next style (Right Detail in xib)

For example can I use next:
cell.style = 'Right Detail' (roughly)
Thanks!
How to create UITableViewCell with an next style (Right Detail in xib)

For example can I use next:
cell.style = 'Right Detail' (roughly)
Thanks!
What you want is UITableViewCellStyleValue1, but you can't set an existing cell's style: you have to set it when you're creating it. Like this:
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"YourIdentifier"];
While the best answer for this question is correct it doesn't touch on the topic of cell reuse.
It turns out you no longer have to use tableView.register.
Instead you can use this approach:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Whenever there's a reusable cell available, dequeue will return it
let cell = tableView.dequeueReusableCell(withIdentifier: "cellIdentifier") ??
UITableViewCell(style: .subtitle, reuseIdentifier: "cellIdentifier")
If you want to use the UITableViewCell and style it programmatically then
Don't register it to your tableView and do this in cellForRowAt
var cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier)
if cell == nil {
var newCell = UITableViewCell(style: .value1, reuseIdentifier: cellIdentifier)
// custom styling on textLabel, detailTextLabel, accessoryType
cell = newCell
}
Note: The deque method is without IndexPath param.