我在.m文件中编写了一些代码,并且有一个单独的.xib文件。在应用程序中,用户只需按箭头即可结束下一页。怎么会这样?
答案 0 :(得分:0)
我理解你的问题,我得到了解决方案。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *strId = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strId];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strId];
}
UIButton *butArrow = [UIButton buttonWithType:UIButtonTypeRoundedRect];
butArrow.frame = CGRectMake(200, 20, 100, 25);;
[butArrow setTitle:@"Arrow" forState:UIControlStateNormal];
butArrow.tag = indexPath.row;
[butArrow addTarget:self action:@selector(actionNavigate:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:butArrow];
return cell;
}
//Button Action method
-(void)actionNavigate:(UIButton*)sender
{
if (sender.tag == 0) //Your particular or specific button tag
{
//Here Write the code for Navigating to next view controller
}
}