Iphone 将用户输入添加到UITableView
我想制作一个iphone应用程序,它有一个UITableView,可以显示用户编写的不同文本 基本上,用户通过iphone键盘输入一些文本,然后将其保存为UITableView中的条目Iphone 将用户输入添加到UITableView,iphone,objective-c,xcode,uitableview,Iphone,Objective C,Xcode,Uitableview,我想制作一个iphone应用程序,它有一个UITableView,可以显示用户编写的不同文本 基本上,用户通过iphone键盘输入一些文本,然后将其保存为UITableView中的条目 有人能告诉我怎么做吗?您可以使用UITextField或UITextView从UITableViewCell中的用户获取输入文本,并且文本输入视图可以作为子视图添加到UITableViewCell中 NSMutableArray *Array = [[NSMutableArray alloc] init]; -
有人能告诉我怎么做吗?您可以使用UITextField或UITextView从UITableViewCell中的用户获取输入文本,并且文本输入视图可以作为子视图添加到UITableViewCell中
NSMutableArray *Array = [[NSMutableArray alloc] init];
-(void)txtFieldreturn
{
[Array addObject:[NSString stringWithFormat:@"%g",[txtField1.text floatValue]]];
[tableView1 reloadData];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [container count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier=@"cell";
cell=[tableView1 dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:cellIdentifier];
}
if(tableView==self.tableView1)
{
cell.textLabel.text=[Array objectAtIndex:indexPath.row];
}
cell.textLabel.font=[UIFont boldSystemFontOfSize:14];
return cell;
}