Reputation: 111
I want to create a tableviewcell and add it on the view(not tableview) as
CGRect aframe=CGRectMake( 20, 20, 200, 200);
UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
cell.frame=aframe;
[self.view addSubview:cell];
But this is not working at all. Can't we create cell independently and add to our view
Upvotes: 0
Views: 287
Reputation: 26859
UITableViewCell
is meant to be used in a UITableView
. I would imagine that there are things happening under the hood in UITableViewCell
that assume that it's operating in a UITableView
. Even if you were able to get this to work, I would expect it to be pretty fragile and vulnerable to breaking during OS updates, again, because it was written with the assumption of being embedded in a UITableView
.
Upvotes: 4