Unable to dequeue a cell with identifier cell_id - must register a nib or a class for the identifier
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I writing xamarin.ios app and using TableView.
I want to Create a custom cell.
So in the designer, I created it with this properties
I try to use it then in TableSource
Like this
public class ExperienceSource : UITableViewSource
{
Experience TableItems;
//NSString cellIdentifier = new NSString("TableCell");
ExperienceController owner;
public ExperienceSource(Experience items, ExperienceController owner)
{
TableItems = items;
this.owner = owner;
}
public override nint NumberOfSections(UITableView tableView)
{
return 1;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return TableItems.Length;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell("cell_id", indexPath) as ExperienceCell;
//Experience item = TableItems[indexPath.Row];
/*if (cell == null)
{
cell = new ExperienceCell(cellIdentifier);
}*/
cell.UpdateCell(TableItems[indexPath.Row].title, TableItems[indexPath.Row].price);
//---- if there are no cells to reuse, create a new one
/*if (cell == null)
{
cell = new ()(CellIdentifier);
}*/
return cell;
}
}
And Here is class for ExperienceCell
public partial class ExperienceCell : UITableViewCell
{
public ExperienceCell (IntPtr handle) : base (handle)
{
}
internal void UpdateCell(string title, string price)
{
ExperienceTitle.Text = title;
ExperincePrice.Text = price;
}
}
When I run app, I got this error
unable to dequeue a cell with identifier cell_id - must register a nib
or a class for the identifier or connect a prototype cell in a
storyboard
How I can fix this?
Thank's for help.
c# .net xamarin xamarin.ios
add a comment |
I writing xamarin.ios app and using TableView.
I want to Create a custom cell.
So in the designer, I created it with this properties
I try to use it then in TableSource
Like this
public class ExperienceSource : UITableViewSource
{
Experience TableItems;
//NSString cellIdentifier = new NSString("TableCell");
ExperienceController owner;
public ExperienceSource(Experience items, ExperienceController owner)
{
TableItems = items;
this.owner = owner;
}
public override nint NumberOfSections(UITableView tableView)
{
return 1;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return TableItems.Length;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell("cell_id", indexPath) as ExperienceCell;
//Experience item = TableItems[indexPath.Row];
/*if (cell == null)
{
cell = new ExperienceCell(cellIdentifier);
}*/
cell.UpdateCell(TableItems[indexPath.Row].title, TableItems[indexPath.Row].price);
//---- if there are no cells to reuse, create a new one
/*if (cell == null)
{
cell = new ()(CellIdentifier);
}*/
return cell;
}
}
And Here is class for ExperienceCell
public partial class ExperienceCell : UITableViewCell
{
public ExperienceCell (IntPtr handle) : base (handle)
{
}
internal void UpdateCell(string title, string price)
{
ExperienceTitle.Text = title;
ExperincePrice.Text = price;
}
}
When I run app, I got this error
unable to dequeue a cell with identifier cell_id - must register a nib
or a class for the identifier or connect a prototype cell in a
storyboard
How I can fix this?
Thank's for help.
c# .net xamarin xamarin.ios
Is your cell created within the TableView in the iOS designer? Or is it defined in a separate file?
– nmilcoff
Nov 26 '18 at 20:32
Separate file . @nmilcoff
– Eugene Sukh
Nov 26 '18 at 20:44
add a comment |
I writing xamarin.ios app and using TableView.
I want to Create a custom cell.
So in the designer, I created it with this properties
I try to use it then in TableSource
Like this
public class ExperienceSource : UITableViewSource
{
Experience TableItems;
//NSString cellIdentifier = new NSString("TableCell");
ExperienceController owner;
public ExperienceSource(Experience items, ExperienceController owner)
{
TableItems = items;
this.owner = owner;
}
public override nint NumberOfSections(UITableView tableView)
{
return 1;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return TableItems.Length;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell("cell_id", indexPath) as ExperienceCell;
//Experience item = TableItems[indexPath.Row];
/*if (cell == null)
{
cell = new ExperienceCell(cellIdentifier);
}*/
cell.UpdateCell(TableItems[indexPath.Row].title, TableItems[indexPath.Row].price);
//---- if there are no cells to reuse, create a new one
/*if (cell == null)
{
cell = new ()(CellIdentifier);
}*/
return cell;
}
}
And Here is class for ExperienceCell
public partial class ExperienceCell : UITableViewCell
{
public ExperienceCell (IntPtr handle) : base (handle)
{
}
internal void UpdateCell(string title, string price)
{
ExperienceTitle.Text = title;
ExperincePrice.Text = price;
}
}
When I run app, I got this error
unable to dequeue a cell with identifier cell_id - must register a nib
or a class for the identifier or connect a prototype cell in a
storyboard
How I can fix this?
Thank's for help.
c# .net xamarin xamarin.ios
I writing xamarin.ios app and using TableView.
I want to Create a custom cell.
So in the designer, I created it with this properties
I try to use it then in TableSource
Like this
public class ExperienceSource : UITableViewSource
{
Experience TableItems;
//NSString cellIdentifier = new NSString("TableCell");
ExperienceController owner;
public ExperienceSource(Experience items, ExperienceController owner)
{
TableItems = items;
this.owner = owner;
}
public override nint NumberOfSections(UITableView tableView)
{
return 1;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return TableItems.Length;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell("cell_id", indexPath) as ExperienceCell;
//Experience item = TableItems[indexPath.Row];
/*if (cell == null)
{
cell = new ExperienceCell(cellIdentifier);
}*/
cell.UpdateCell(TableItems[indexPath.Row].title, TableItems[indexPath.Row].price);
//---- if there are no cells to reuse, create a new one
/*if (cell == null)
{
cell = new ()(CellIdentifier);
}*/
return cell;
}
}
And Here is class for ExperienceCell
public partial class ExperienceCell : UITableViewCell
{
public ExperienceCell (IntPtr handle) : base (handle)
{
}
internal void UpdateCell(string title, string price)
{
ExperienceTitle.Text = title;
ExperincePrice.Text = price;
}
}
When I run app, I got this error
unable to dequeue a cell with identifier cell_id - must register a nib
or a class for the identifier or connect a prototype cell in a
storyboard
How I can fix this?
Thank's for help.
c# .net xamarin xamarin.ios
c# .net xamarin xamarin.ios
asked Nov 26 '18 at 20:26
Eugene SukhEugene Sukh
437112
437112
Is your cell created within the TableView in the iOS designer? Or is it defined in a separate file?
– nmilcoff
Nov 26 '18 at 20:32
Separate file . @nmilcoff
– Eugene Sukh
Nov 26 '18 at 20:44
add a comment |
Is your cell created within the TableView in the iOS designer? Or is it defined in a separate file?
– nmilcoff
Nov 26 '18 at 20:32
Separate file . @nmilcoff
– Eugene Sukh
Nov 26 '18 at 20:44
Is your cell created within the TableView in the iOS designer? Or is it defined in a separate file?
– nmilcoff
Nov 26 '18 at 20:32
Is your cell created within the TableView in the iOS designer? Or is it defined in a separate file?
– nmilcoff
Nov 26 '18 at 20:32
Separate file . @nmilcoff
– Eugene Sukh
Nov 26 '18 at 20:44
Separate file . @nmilcoff
– Eugene Sukh
Nov 26 '18 at 20:44
add a comment |
1 Answer
1
active
oldest
votes
You are missing the registration of the UITableViewCell in the UITableView.
Please add something like this in your ViewController (the important part is the RegisterNibForCellReuse
sentence):
public override void ViewDidLoad()
{
base.ViewDidLoad();
MyTableView.RegisterNibForCellReuse(UINib.FromName(nameof(ExperienceCell), NSBundle.MainBundle), "cell_id");
MyTableView.Source = new ExperienceSource(..., ...);
// .. your code
}
This is a necessary step when you declare your UITableViewCells outside the UITableView.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53488525%2funable-to-dequeue-a-cell-with-identifier-cell-id-must-register-a-nib-or-a-clas%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are missing the registration of the UITableViewCell in the UITableView.
Please add something like this in your ViewController (the important part is the RegisterNibForCellReuse
sentence):
public override void ViewDidLoad()
{
base.ViewDidLoad();
MyTableView.RegisterNibForCellReuse(UINib.FromName(nameof(ExperienceCell), NSBundle.MainBundle), "cell_id");
MyTableView.Source = new ExperienceSource(..., ...);
// .. your code
}
This is a necessary step when you declare your UITableViewCells outside the UITableView.
add a comment |
You are missing the registration of the UITableViewCell in the UITableView.
Please add something like this in your ViewController (the important part is the RegisterNibForCellReuse
sentence):
public override void ViewDidLoad()
{
base.ViewDidLoad();
MyTableView.RegisterNibForCellReuse(UINib.FromName(nameof(ExperienceCell), NSBundle.MainBundle), "cell_id");
MyTableView.Source = new ExperienceSource(..., ...);
// .. your code
}
This is a necessary step when you declare your UITableViewCells outside the UITableView.
add a comment |
You are missing the registration of the UITableViewCell in the UITableView.
Please add something like this in your ViewController (the important part is the RegisterNibForCellReuse
sentence):
public override void ViewDidLoad()
{
base.ViewDidLoad();
MyTableView.RegisterNibForCellReuse(UINib.FromName(nameof(ExperienceCell), NSBundle.MainBundle), "cell_id");
MyTableView.Source = new ExperienceSource(..., ...);
// .. your code
}
This is a necessary step when you declare your UITableViewCells outside the UITableView.
You are missing the registration of the UITableViewCell in the UITableView.
Please add something like this in your ViewController (the important part is the RegisterNibForCellReuse
sentence):
public override void ViewDidLoad()
{
base.ViewDidLoad();
MyTableView.RegisterNibForCellReuse(UINib.FromName(nameof(ExperienceCell), NSBundle.MainBundle), "cell_id");
MyTableView.Source = new ExperienceSource(..., ...);
// .. your code
}
This is a necessary step when you declare your UITableViewCells outside the UITableView.
answered Nov 26 '18 at 20:52
nmilcoffnmilcoff
922317
922317
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53488525%2funable-to-dequeue-a-cell-with-identifier-cell-id-must-register-a-nib-or-a-clas%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is your cell created within the TableView in the iOS designer? Or is it defined in a separate file?
– nmilcoff
Nov 26 '18 at 20:32
Separate file . @nmilcoff
– Eugene Sukh
Nov 26 '18 at 20:44