Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 将用户输入添加到UITableView_Iphone_Objective C_Xcode_Uitableview - Fatal编程技术网

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]; -

我想制作一个iphone应用程序,它有一个UITableView,可以显示用户编写的不同文本

基本上,用户通过iphone键盘输入一些文本,然后将其保存为UITableView中的条目


有人能告诉我怎么做吗?

您可以使用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;

}