iphone - Can't get texts on UITableViewCell -
i want multiple custom texts on cell of uitableview. want these texts after clicking on dynamically added button on cell. can't use didrowselectedatindex method. have own selector executing don't know how can texts on each cell. can me?
thank
- make labels global variables
- create yur cell default style cell.
- add labels contentview of cell without text.
- add button.
in method button invokes after click set texts labels.
uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; customlabel1 = [[uilabel alloc] initwithframe:cgrectmake(5, 5, 50, 20)]; customlabel2 = [[uilabel alloc] initwithframe:cgrectmake(55, 5, 50, 20)]; [cell.contentview addsubview:customlabel1]; [cell.contentview addsubview:customlabel2]; }
and
- (ibaction) click { customlabel1.text = @"yaya"; customlabel2.text = @"gaga"; }
Comments
Post a Comment