Ios Like&Comment按钮,然后将其保存到parse
有人知道如何在tableview页脚下实现这些按钮,然后保存并检索以进行解析吗Ios Like&Comment按钮,然后将其保存到parse,ios,ios7,Ios,Ios7,有人知道如何在tableview页脚下实现这些按钮,然后保存并检索以进行解析吗 - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { NSString *cellidentifier=@"footer"; UITableViewCell *footer = [tableView dequeueReusableCellWithIdentifier:Cell
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
NSString *cellidentifier=@"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
如果要将按钮添加到节的页脚视图,请在视图中为页脚创建类似按钮或注释的按钮,然后添加目标。你的按钮似乎在别的地方。无法检索uitableview单元格。以下是示例代码:
- (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];
}
按钮在页脚吗?如果是这样的话,按钮是否已被设置:当按钮被选择时被调用?是的,它正在被调用