Using UITableView we can display a listing of data in the form of a queue. It’s in the form of a one-dimensional row.UITableView representing a list of items using the UITableViewCell class.Its a single component repeating in the table view for the sake of representing a bunch of data. Here is an example for a beginner developer. Just follow the given steps to perform the implementation of the simple table view. Step 1: Create a new Xcode Project, Select Single view Application, Give a name to project and select language objective c, Set a location to save the project. Step 2: Drag Table view from the Component list at view Controller,
Step 3: Add Delegates with viewContoller.
Step 4: Open viewController .h, Add tableView Delegates and declare 3 arrays for 3 sections for displaying images and displaying label text.

Step 5: Add images in Bundle.
Step 6: Implement Array text and Array Images on viewDidLoad()

Step 7: Add number of sections,
Step 8: Add number of rows in table,
Step 9: add Table View delegates Description cellForRowAtIndexPath. –
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cell=@"cellIdentifier"; UITableViewCell *cell1=[tableView dequeueReusableCellWithIdentifier:cell]; if(cell1==Nil) { cell1=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cell]; if(indexPath.section==0) { cell1.textLabel.text=[array objectAtIndex:indexPath.row]; cell1.imageView.image=[UIImage imageNamed:[images objectAtIndex:indexPath.row]]; } else if (indexPath.section==1) { cell1.textLabel.text=[array1 objectAtIndex:indexPath.row]; cell1.imageView.image=[UIImage imageNamed:[images2 objectAtIndex:indexPath.row]]; } else { cell1.textLabel.text=[array2 objectAtIndex:indexPath.row]; cell1.imageView.image=[UIImage imageNamed:[images3 objectAtIndex:indexPath.row]]; } } return cell1 ; } |
Output:
Thank you if you have a question please comment below, Please comment and share the article if you find something useful.