Hi I am trying to use a tableview on my uiviewcontroler on my .h I put this code:
@interface SecondViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *myTableView;
}
@property (nonatomic, retain) IBOutlet UITableView *myTableView;
and on my .m:
I modify my code but now it says my Response_array is undeclared and also myTablevView not found on object type uitableviewcell
@synthesize myTableView;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_responseArray count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] init];
}
NSString *cellValue = [_responseArray objectAtIndex:indexPath.row];
[cell.textLabel setText:cellValue];
return cell;
}
Here is my Response_array
NSArray* Response_array = [json objectForKey:@"avenidas"];