2014-02-24 3 views
0

저는 문제가 생겼습니다. 간단합니다. TableView 객체가있는 ViewController (SplitViewController 아님) ViewController가 있습니다. 사용자가 테이블의 행을 클릭하면 오른쪽의 내 레이블이 적절하게 변경되기를 원합니다.didSelectRowAtIndexPath 값을 할당하려면

My screen - ViewController with a TableView. It is NOT a SplitViewController

내 라벨 나는이 코드로의 TableView를 채우는

@property (weak, nonatomic) IBOutlet UILabel *rotuloDetalhesLabel; 

을 변경하려면 그 (텍스트와 오른쪽에있는 "놈이 Vinho을"). viewDidLoad 메서드에서 개체를 만들고 "vinhos"라는 NSArray에 넣습니다. 있는 TableView

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Configura a Cell 
    static NSString *CellIdentifier = @"TableCell"; 
    TableCell *cell = (TableCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 
     cell = [[TableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    } 

    Vinho *vinho = [vinhos objectAtIndex:indexPath.row]; 

    // rotuloLabel is the Label of the row 
    cell.rotuloLabel.text = vinho.rotulo; 

    return cell; 
} 

나는 그것을 didSelectRowAtIndexPath 방법에 이루어집니다하지만 난 잘 모릅니다 추측을 채우기

// Create object 
Vinho *vinho1 = [Vinho new]; 
vinho1.rotulo = @"Adega de Borda Premium"; 

Vinho *vinho2 = [Vinho new]; 
vinho2.rotulo = @"Adega de Borda Premium 2"; 


// Populate the NSArray with the objects that I create before 
vinhos = [NSArray arrayWithObjects: vinho1, vinho2, nil]; 

. 중요한 것을 게시하는 것을 잊어 버리면 말해주십시오.

+0

당신은 당신의'-didSelectRowAtIndexPath' 방법을 게시하시기 바랍니다 수 : 당신이 말한대로 코멘트에 페이드 애니메이션을 wan't 경우

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Vinho *vinho = [vinhos objectAtIndex:indexPath.row]; NSString *cellRotuloText = vinho.rotulo; rotuloDetalhesLabel.text = cellRotuloText; } 

, 어쩌면 이것은 당신이 시작할 수 있을까? – Mischa

답변

0

오른쪽의 라벨을 셀 텍스트로 변경하지 않겠습니까? xCode ios5: How to fade out a label text after an interval?

+0

감사합니다. @Jonathan이 완벽하게 작동합니다. 떨어져서, 약간의 효과와 함께 텍스트를 바꿀 수있는 방법이 있습니까? 페이드 인이나 뭐 그런 것일까 요? –

+0

내 편집을보고이 질문의 향후 사용을 위해 질문을 업데이트하십시오. 내 대답이 마음에 들면 투표를하고 동의하십시오. –

관련 문제