2012-02-06 4 views
2

사용자 정의 셀의 UIButton IBAction 이벤트를 제공하려고합니다.사용자 정의 셀의 UIButton에 IBAction 이벤트를 제공하는 방법은 무엇입니까?

아래 코드로 시도했지만 충돌이 발생했습니다.

위젯을 &으로 만들려면 어떻게하면 내 UITableView 클래스에서 사용할 수 있습니까? 여기

-(void)showAttachmentsFromCell:(UIButton *)sender 
{ 
    gotoClass *obj = [[gotoClass alloc] initWithNibName:@"gotoClass" bundle:nil]; 
    [self.navigationController pushViewController:obj animated:YES]; 
    [obj release]; 
} 

Customcell class

-(IBAction)btnShowAttachmentClick:(UITableView *)aTblViewCommon 
{ 
    [(ShowTechAndProfDetailsVC *)aTblViewCommon.delegate performSelector:@selector(showAttachmentsFromCell:) withObject:nil]; 
} 

UIViewController class having UITableViewcellForRowAtIndexPath

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if(appDelegate.intCountSwipeForView == 1 || appDelegate.intCountSwipeForView == 2) 
    { 
     objCellView = [ViewExpAndEduCustomCell dequeOrCreateInTable:tableView]; 

     objCellView.selectionStyle = UITableViewCellSelectionStyleNone; 
     //objCellView.btnPaperClip.tag = indexPath.row; 
     [objCellView.btnPaperClip addTarget:self action:@selector(showAttachmentsFromCell:) forControlEvents:UIControlEventTouchUpInside]; 


     objCellView.lblName.text = @"asdfsdf"; 
     objCellView.lblTitleOrCourse.text = @"asdf"; 
     objCellView.lblStartDate.text = @"23-Nov-2001"; 
     objCellView.lblEndDate.text = @"04-Feb-2002"; 


     [objCellView.txtViewSummary setTextColor:TEXT_COLOR_GRAY_FOR_TABLECELL]; 
     [objCellView.txtViewSummary setFont:[UIFont systemFontOfSize:17.0]]; 
     [objCellView.txtViewSummary setContentInset:UIEdgeInsetsMake(-5, 0, 0, 0)]; 
     [objCellView.txtViewSummary setBackgroundColor:[UIColor clearColor]]; 
     [objCellView.txtViewSummary setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 
    } 
if(appDelegate.intCountSwipeForView == 1){ 
     objCellView.txtViewSummary.text = @"Experience.This is sample text.This text can be of 150 characters.No more than that.You can also attach your achievment but only pdf,Image or video"; 
     return objCellView; 
} 
+0

쇼 코드? – Sarah

+0

나는 당신이있는 UIButton에있는 TableView의 액세서리 볼 수있는 시도 해 봤나 단지 tableviewcell 클래스 – Heena

+0

의 performselector에 전화 tableview.I에 전화하고 있지 않다를 호출

- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath{ //creating cell or resusing cell //after getting the cell and casting it into your Customcell [cell.mButton addTarget:self action:@selector(showAttachmentsFromCell:) forControlEvents:UIControlEventTouchUpInside]; } 

답변

1

헤이

에서 다음 Customcell 수업 시간에 당신이 버튼의 IBOutlet을 가지고있다 당신이 method..in에있는 tableview
+0

시도했지만 작동하지 않습니다 – Heena

+0

무엇이 작동하지 않습니다 ??? –

+0

그것은 내가있는 UITableViewCell에서 해당 버튼 함께 IBOutlet을 촬영 한 선택 방법 – Heena

관련 문제