Lets say I have a tableview created in the storyboard and referenced as "tableViewJobList" and I want to generate a tableview in each cell of tableViewJobList so I do it in cellForRowAtIndexPath.
My .h file (tableViewJobList delegate and datasource is set to viewcontroller in storyboard)
#interface JobByAccountViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
#property (weak, nonatomic) IBOutlet UITableView *tableViewJobList;
...
#end
My .m file
...
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//realJoblist is my data array
if (tableView == _tableViewJobList) {
return [realJobList count];
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView == _tableViewJobList) {
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == _tableViewJobList) {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
//each cell has a tableview
UITableView *subTableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
subTableView.delegate = self;
subTableView.dataSource = self;
subTableView.frame = CGRectMake(0, 0, cell.bounds.size.width, cell.bounds.size.height);
[cell addSubview:subTableView];
return cell;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == _tableViewJobList) {
NSLog(#"outer tableview");
} else {
NSLog(#"inner tableview");
}
...
}
...
In heightForRowAtIndexPath shouldn't the print statement trigger in the else block because those are the tableviews I created programmatically?
Try this,,,
you just replace your table outlet name.
- (void)viewDidLoad {
[super viewDidLoad];
tableViewJobList.delegate = self;
tableViewJobList.dataSource = self;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//realJoblist is my data array
if (tableView == _tableViewJobList) {
return [realJobList count];
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView == _tableViewJobList) {
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == _tableViewJobList) {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
//each cell has a tableview
UITableView *subTableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
tableViewJobList.delegate = self;
tableViewJobList.dataSource = self;
subTableView.frame = CGRectMake(0, 0, cell.bounds.size.width, cell.bounds.size.height);
[cell addSubview:subTableView];
return cell;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == _tableViewJobList) {
NSLog(#"outer tableview");
} else {
NSLog(#"inner tableview");
}
...
}
... `enter code here`
Related
[![enter image description here][1]][1]
I have a tableview.In that tableview I need to display collection view in different sections.I took proto type tableview cell and I displayed collection view.I used same collection view for different sections in that tableview. when I clicked collection view cell I got the collection view section and indexPath but how can I get the tableview section and indexPath row?
#pragma mark- UITableView Delegate & Datasource methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 0) {
return 1;
}
else if (section == 1) {
return 1;
}
else if (section == 2) {
return 1;
}
else
return 1;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
return 128;
}
else if (indexPath.section == 1) {
return 321;
}
else if (indexPath.section == 2) {
return 321;
}
else
return 262;
}
- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
NSString *sectionName;
switch (section) {
case 0:
sectionName = #"";
break;
case 1:
sectionName = #"Features Products";
break;
case 2:
sectionName = #"New Products";
break;
case 3:
sectionName = #"";
break;
default:
break;
}
return sectionName;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
FeaturesTableViewCell *featureCell;
CustomTableViewCell *cell;
CustomTableViewCell *normalCell;
FashionTableViewCell *fashionCell;
if (indexPath.section==0) {
featureCell = [tableView dequeueReusableCellWithIdentifier:#"FeaturesCell"];
if (featureCell==nil) {
featureCell = [[FeaturesTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"FeaturesCell"];
}
return featureCell;
}
else if (indexPath.section==1) {
cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:#"CustomTableViewCell"];
if (cell==nil)
{
cell = [[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"CustomTableViewCell"];
}
cell.superIndexPath = indexPath;
return cell;
}
else if (indexPath.section==2) {
normalCell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:#"CustomTableViewCell"];
if (normalCell==nil)
{
normalCell = [[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"CustomTableViewCell"];
}
cell.superIndexPath = indexPath;
return normalCell;
}
else{
fashionCell = (FashionTableViewCell *)[tableView dequeueReusableCellWithIdentifier:#"FashionTableViewCell"];
if (fashionCell==nil)
{
fashionCell = [[FashionTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"FashionTableViewCell"];
}
return fashionCell;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(#"UITableView Selected index----%ld",indexPath.row);
}
#import <UIKit/UIKit.h>
#import <Foundation/NSObject.h>
#import <Foundation/Foundation.h>
#interface CustomTableViewCell : UITableViewCell<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
#property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
#property (strong ,nonatomic) NSIndexPath *superIndexPath;
#end
#import "CustomTableViewCell.h"
#implementation CustomTableViewCell
#synthesize superIndexPath;
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
#pragma mark- UICollectionView Delegate & Datasource methods
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
NSUInteger numberOfSections= 0;
numberOfSections = 1;
return numberOfSections;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
NSUInteger numberOfItems= 0;
numberOfItems = 6;
return numberOfItems;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell *cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:#"cell" forIndexPath:indexPath];
UIImageView *imgView = (UIImageView *) [cell viewWithTag:1000];
imgView.image = [UIImage imageNamed:#"slideImage1"];
[cell.contentView addSubview:imgView];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
NSLog(#"Selected superIndexPath section---------%ld",(long)superIndexPath.section);
NSLog(#"Selected superIndexPath.row---------%ld",superIndexPath.row);
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
return 0.0f;
}
- (UIEdgeInsets)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(0, 0, 0, 0);
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
return 0.0f;
}
#end
you can add a property in the CustomTableViewCell like superIndexPath. And set the property at - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath like
cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:#"CustomTableViewCell"];
if (cell==nil)
{
cell = [[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"CustomTableViewCell"];
}
cell.superIndexPath = indexPath;
return cell;
and When you try to get the tableView indexPath in the method - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath by using self.superIndexPath.
You can use superView property of the collectionViewCell inside didSelectItemAtIndex and cast it as your CustomTableViewCell. Try this code inside didSelectItemAtIndex
if let tableViewcell = collectionViewCell.superview?.superview as? CustomTableViewCell {
let indexPath = customTableView.indexPath(for: tableViewcell)
}
I want show a tableView into a cell like:
_____________________________________
| (IMAGE) ______________ | --CELL 0
| | MyCustomText|--CELL 0.0 |
| |_____________| |
| |MyCustomText2|--CELL 0.1 |
| |_____________| |
| |
| |
--------------------------------------
_____________________________________
| (IMAGE) 2 | --CELL 1
--------------------------------------
I'm trying add a tableView in storyboard and then connect with a new TableviewController and with a new CustomCellTableView, but this not show anything in the row's table.
It's possible? How can I declare the viewController or needn't add ViewController?
Thanks!
I think you don't need a new tableview controller. In your table cell, you can add another tableview.
#interface ImageCell : UITableViewCell<UITableViewDataSource,UITableViewDelegate>
#property (retain, nonatomic) IBOutlet UITableView *abc;
#end
and implement datasource and delegate method as usual.
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<##"reuseIdentifier"#> forIndexPath:indexPath];
// Configure the cell...
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (tableView == self.tableView) {
return 8;
} else {
return 3;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
if (tableView == self.tableView) {
cell = [self.tableView dequeueReusableCellWithIdentifier:#"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"cell"];
}
if (indexPath.row == 0) {
self.childTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 100)];
self.childTableView.delegate = self;
self.childTableView.dataSource = self;
[cell.contentView addSubview:self.childTableView];
}else {
cell.textLabel.text = #"Pavan";
}
} else if (tableView == self.childTableView){
cell = [self.tableView dequeueReusableCellWithIdentifier:#"childCell"];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"childCell"];
}
cell.textLabel.text = #"hi";
}
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == self.tableView) {
if (indexPath.row == 0) {
return 250;
} else {
return 100;
}
} else {
return 50;
}
}
I am working on a project that is both iOS7 and iOS8. And I ran into this bug on iOS8, where the tableview will "jump" when selecting an item.
This bug is only there when estimated height is set and it differs from the row height.
Here are two gifs of the same code in iOS8 and iOS7. First iOS8:
And now in iOS7:
I have made a sample project showing the bug here: https://github.com/bjarkehs/TableViewiOS8Bug
I am not sure if I am simply missing something, but I am stuck with this issue and I haven't been able to find anything on this.
Here are my tableView methods:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 1) {
return 30;
}
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"cell"];
}
cell.textLabel.text = [NSString stringWithFormat:#"%# %ld", #"Wat", indexPath.row];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 45.f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50.f;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.navigationController pushViewController:[UIViewController new] animated:YES];
}
Here is an example viewcontroller where the calculated height is not hardcoded, showing the same issue:
#import "ViewController.h"
#interface ViewController ()
#property (weak, nonatomic) IBOutlet UITableView *tableView;
#end
#implementation ViewController {
NSMutableArray *_items;
CGFloat _estimatedHeight;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.delegate = self;
self.tableView.dataSource = self;
_estimatedHeight = 70.f;
CGFloat randomOffset = 30.f;
_items = [NSMutableArray new];
for (NSInteger i = 0; i < 3; i++) {
NSMutableArray *tempItems = [NSMutableArray new];
for (NSInteger j = 0; j < 30; j++) {
NSInteger offset = arc4random_uniform(randomOffset);
[tempItems addObject:#(_estimatedHeight + (randomOffset/2) - offset)];
}
[_items addObject:tempItems];
}
// Do any additional setup after loading the view.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 1) {
return 30;
}
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"cell"];
}
cell.textLabel.text = [NSString stringWithFormat:#"%# %ld", #"Wat", indexPath.row];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return _estimatedHeight;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [[[_items objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] floatValue];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.navigationController pushViewController:[UIViewController new] animated:YES];
}
#end
Your implementation for Estimated Height For At Index isn't something I've seen before. Have a look at this where I detailed using this pattern...
Estimated Height Example
Is it possible to load a View of height 672 as TableView header?I added it But i am not able to scroll and See the tableview cell Details.
i have used the code
ACCRemainderView *header = [ACCRemainderView customHeaderView];
[self.tableView setTableHeaderView:header];
In the Remainder View
+ (id)customHeaderView
{
ACCRemainderView *customView = [[[NSBundle mainBundle] loadNibNamed:#"ACCRemainderView" owner:nil options:
nil] lastObject];
//make sure customView is not nil or the wrong class!
if ([customView isKindOfClass:[ACCRemainderView class]]) {
return customView;
} else {
return nil;
}
}
Try implementing - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section in your UITableViewController and return [ACCRemainderView customHeaderView].
Set tableHeaderView is the best choice. I tested and it works.
ViewForHeaderInSection can not because at this view header's height is larger than table's height.
You can not scroll, I think your tableView is overlap by another view.
- (void)viewDidLoad
{
[super viewDidLoad];
_tableView.dataSource = self;
_tableView.delegate = self;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSString *title=[self tableView:tableView titleForHeaderInSection:section];
if ( !title )
return nil;
UIView *view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 500)];
view.backgroundColor = [UIColor greenColor];
return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 500;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 2;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return #"abcd";
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = #"a";
return cell;
}
I am trying to reuse an existing UITableViewController by embedding a UITableView in the footer of an existing table.
The premise is that on selection of a row, the footer will appear with a list of further, related options. This works fine but the accessibility inspector is unable to read the rows in the table embedded in the footer.
I created a quick sample of code to show the issue.
Code for the main UITableViewController
#interface MyUITableViewController ()
#end
#implementation MyUITableViewController{
MySubUITableViewController *dataSourceClass;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
dataSourceClass = [[MySubUITableViewController alloc] init];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
if(section == 0){
CGRect tableFrame = CGRectMake(0, 0, self.view.frame.size.width, 200);
UITableView *view = [[UITableView alloc]initWithFrame:tableFrame style:UITableViewStylePlain];
view.rowHeight = 30;
view.scrollEnabled = YES;
view.showsVerticalScrollIndicator = YES;
view.userInteractionEnabled = YES;
view.bounces = YES;
view.delegate = dataSourceClass;
view.dataSource = dataSourceClass;
return view;
}
return nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if(section == 0)
return 200;
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"identifier";
UITableViewCell *cell;
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [NSString stringWithFormat:#"Section %d Row %d", indexPath.section, indexPath.row];
return cell;
}
The code for the table to embed within the footer
#implementation MySubUITableViewController {
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"subCell";
UITableViewCell *cell;
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [NSString stringWithFormat:#"Footer Row %d", indexPath.row];
return cell;
}
#end
Anyone know how to get round the Footer rows not being read by accessibility?
I tried
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
}
but to avail.
Thanks
Ok, so the only solution I could get to work, is to create a custom UITableViewCell which implements the UITableViewDataSource, UITableViewDelegate delegates.
Effectively creating a table inside a UITableViewCell.
Something along the lines of:
#interface MyTableWrappingCell() <UITableViewDataSource, UITableViewDelegate>
#property (nonatomic, weak) UITableView *myTableView;
#end
#implementation MyTableWrappingCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
UITableView *myTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
myTableView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
myTableView.dataSource = self;
myTableView.delegate = self;
[self.contentView addSubview:myTableView];
self.myTableView = myTableView;
}
return self;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"subCell";
UITableViewCell *cell;
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [NSString stringWithFormat:#"internal Row %d", indexPath.row];
return cell;
}
- (void) forceLoad{
[self.myTableView reloadData];
}
#end
Accessibility is then able to read the contents.