I am creating an application in which I have to divide the cell into three parts. For example, I have to specify the title in one cell and immediately display the corresponding data.
How can i do this?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell"; myappAppDelegate *mydelegate=(myappAppDelegate *)[[UIApplication sharedApplication]delegate]; database *objdata =[mydelegate.myarray objectAtIndex:indexPath.row]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryNone; if (indexPath.row == 0) { UILabel *temp = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 200, 44)]; temp.text =@ "Main Balance"; temp.backgroundColor = [UIColor clearColor]; temp.font = [UIFont systemFontOfSize:19]; [cell addSubview:temp]; UILabel *temp1 = [[UILabel alloc] initWithFrame:CGRectMake(240, 0, 50, 44)]; temp1.text =@ "2000"; temp1.backgroundColor = [UIColor clearColor]; temp1.font = [UIFont systemFontOfSize:19]; [cell addSubview:temp1]; else if(indexPath.row==1) { UILabel *temp = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 108, 44)]; temp.text =@ "Income"; temp.backgroundColor = [UIColor clearColor]; temp.font = [UIFont systemFontOfSize:19]; [cell addSubview:temp]; } else { UILabel *temp = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 108, 44)]; temp.text =[NSString stringWithFormat:@"%d",objdata.amount]; temp.backgroundColor = [UIColor clearColor]; temp.font = [UIFont systemFontOfSize:19]; [cell addSubview:temp]; } enter code here
On the main screen, I create the One Main Blaance text box and two buttons, such as Earnings, Expenses, and Last Button. When I click "Income", another view is displayed, in which "Add income in the text box" and one button "Add to the main balance". I type the amount of income in this text box and then on βSaveβ, it will save it in the database, I do the same for βExpensesβ, then I click On the main balance button the amount is added or subtracted in the text box of the main balance, which I showing on the main screen. Then click the "Final Display" button on the main screen, it will display three labels "Revenue", "Expense", "Main Balance" .. in TableView.I get the value Under Income and Expense But it only displays the initial value, which I entered into the database. Development time on request.
My question is: - Suppose I add 4 data, then the final display will display all this data. Even if I add more data, they will also be shown on the final display .... I hope U can get my point..please Direct me, I'm so confused.