赞和评论按钮,然后保存它来解析
问题描述:
有谁知道如何在tableview脚本下实现这些按钮,然后保存它和retreive解析?赞和评论按钮,然后保存它来解析
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
NSString *[email protected]"footer";
UITableViewCell *footer = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UIView* FView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 100.0)];
UIButton *like = (UIButton *)[footer viewWithTag:1];
[button addTarget:self action:@selector(buttonwastapped:) forControlEvents:UIControlEventTouchUpInside];
[FView addSubview:self.like];
return [FView autorelease];
}
- (void)buttonwastapped:(UIButton*)sender
{
PFUser *user = [PFUser currentUser];
PFRelation *relation = [user relationForKey:@"likes"];
[relation addObject:post];
[user saveInBackground];
} //i try to use that but nothing happened
答
,如果你想添加按钮页脚视图部分的视图中创建一个按钮(如或注释)页脚,并添加目标
。似乎你正在其他地方分配按钮。 theres没有用于检索uitableview cell.here是示例代码:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView* FView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 100.0)];
UIButton *likeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
likeBtn.frame = CGRectMake(0, 0, 30, 40); // set your btn frame
[likeBtn addTarget:self action:@selector(buttonwastapped:) forControlEvents:UIControlEventTouchUpInside];
[FView addSubView:likeBtn];
return [FView autorelease];
}
页脚中的按钮?如果是这样,是'buttonwastapped:'当选择该按钮时被调用? – 2014-09-22 01:26:57
是啊,它被称为 – 2014-09-23 01:32:49