嗨,我正在实施一个表格,我收到请求我有学生列表,我想添加为我的室友我有两个按钮接受和拒绝当我点击接受按钮时问题就在这里从数组中删除,并且我想在接受请求的情况下将删除的行值转移到 nextview 控制器的表中。并且如果单击拒绝按钮只想删除行而不是将单元格的值移动到下一个视图控制器中我正在使用情节提要实现这个项目任何人都可以知道请分享我这是代码cellForRowAtIndexPath:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultCell"];
if(cell == nil) {
cell =[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"DefaultCell"];
}
acceptreq = [UIButton buttonWithType:UIButtonTypeRoundedRect];
acceptreq.frame =CGRectMake(170, 10, 60, 30);
rejectreq = [UIButton buttonWithType:UIButtonTypeRoundedRect];
rejectreq.frame =CGRectMake(240, 10, 60, 30);
[acceptreq setTitle:@"Accept" forState:UIControlStateNormal];
[rejectreq setTitle:@"Reject" forState:UIControlStateNormal];
[acceptreq addTarget:self action:@selector(Acceptrequest:) forControlEvents:UIControlEventTouchUpInside];
[rejectreq addTarget:self action:@selector(Rejectrequest:) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:acceptreq];
[cell addSubview:rejectreq];
[acceptreq setTag:indexPath.row];
cell.textLabel.text = [myarray objectAtIndex:indexPath.row];
return cell;
}