I am using a UIView
as a popup in my app.
I have added a UITableview
in to this UIVIew
. However, the content of the UITableView
doesn't get populated. I have set the delegate
and datasource
from IB
and also from the code as well.
None of theDelegate
methods are being called.
Code as follows:
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
self.tablev.delegate = self;
self. tablev.dataSource = self;
[self addSubview:self. tablev];
}
View .h
class
@interface MyView : UIView <UITableViewDataSource,UITableViewDelegate>
UPDATE
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MyView
*cell = [tableView dequeueReusableCellWithIdentifier:@"c" forIndexPath:indexPath];
if (cell == nil)
{
cell = [[MyView
alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:@"c"];
}
cell.la.text=@"hiiiii";