2017-06-02 14 views

答えて

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 
    } 
} 
+0

は別です:うん 'cell.accessoryView = butArrow' – Koen

+0

が、私はOPに非常にサンプルました。 – user3182143

関連する問題