UITableViewCell
にUITextField
を使用する必要があります。これはParseオープンソースを使用しており、タイトルを返信したいと思います。だから、cellForRowAtIndexPath
を呼び出すときには、このようなことをする必要があります。iOS:メソッドを呼び出すUITableViewCellのUITextField
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
UITextField *TextField = (UITextField *) [cell viewWithTag:284];
[TextField setReturnKeyType:UIReturnKeyDone];
[TextField addTarget:self
action:@selector(TitleTextFieldFinished:indexPath:object:)
forControlEvents:UIControlEventEditingDidEndOnExit];
TextField.text = [object objectForKey:@"Toppingname"];
return cell;
}
そして、それはこのように呼ばれるかもしれない:いずれかがそれは素晴らしいだろう手助けができれば
- (void)TitleTextField:(UITextField *)TextField:(NSIndexPath *)indexPath:(PFObject *)object
{
[TextField resignFirstResponder];
PFQuery *item = [PFQuery queryWithClassName:@"className"];
[item getObjectInBackgroundWithId:self.menuid
block:^(PFObject *title, NSError *error) {
NSString *newTitle = @"New title";
title[@"title"] = newTitle;
[title saveInBackground];
}];
}
!
FYI - メソッド名と変数名は小文字で始まります。クラス名は大文字で始まります。この標準に従うことで、コードを他の人が読みやすくすることができます。 – rmaddy
また、匿名のパラメータ名を持つObjective-Cのメソッド名を避ける必要があります。あなたの提案されたテキストフィールドハンドラは 'TitleTextField ::'という名前です。この名前付け規則と空白がないと、コードが読みにくくなります。 – rmaddy