How to access to subview in the cell of tableview?

Up vote 2 down vote favorite 1 share g+ share fb share tw.

In the method "sliderValueChange" I need to access to the label in the cell. This is my code: // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = tableView dequeueReusableCellWithIdentifier:CellIdentifier; if (cell == nil) { cell = UITableViewCell alloc initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier autorelease; cell.

SelectionStyle = UITableViewCellSelectionStyleNone; cell.textLabel. Font = UIFont boldSystemFontOfSize:15; } cell.textLabel. Text = @"Soglia"; UISlider *slider = UISlider alloc initWithFrame:CGRectMake(174,12,168,23) autorelease; slider.

MaximumValue = 70; slider. MinimumValue = 5; cell addSubview:slider; cell. AccessoryView = slider; slider addTarget:self action:@selector(sliderValueChange:) forControlEvents:UIControlEventValueChanged; slider release; UILabel *labelVal = UILabel alloc initWithFrame:CGRectMake(218, 40, 30, 23); labelVal.

Text = @"0"; cell addSubview:labelVal; return cell; } - (void)sliderValueChange:(id)sender { UISlider *theSlider = (UISlider *)sender; UITableViewCell *cell = (UITableViewCell *)theSlider. Superview; UITableView *tableView = (UITableView *)cell. Superview; //here I need to access to labelVal... } objective-c cocoa-touch uitableview uitableviewcell link|improve this question asked Jul 28 '11 at 13:39Dany3171210 62% accept rate.

(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = tableView dequeueReusableCellWithIdentifier:CellIdentifier; if (cell == nil) { cell = UITableViewCell alloc initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier autorelease; cell. SelectionStyle = UITableViewCellSelectionStyleNone; cell.textLabel. Font = UIFont boldSystemFontOfSize:15; //slider UISlider *slider = UISlider alloc initWithFrame:CGRectMake(174,12,168,23) autorelease; slider.

MaximumValue = 70; slider. MinimumValue = 5; slider. Tag=11; slider addTarget:self action:@selector(sliderValueChange:) forControlEvents:UIControlEventValueChanged; cell.

ContentView addSubview:slider; //label UILabel *labelVal = UILabel alloc initWithFrame:CGRectMake(218, 40, 30, 23); labelVal. Text = @"0"; labelVal. Tag=22; cell.

ContentView addSubview:labelVal; // cell. AccessoryView = slider; } cell.textLabel. Text = @"Soglia"; return cell; } - (void)sliderValueChange:(id)sender { UISlider *theSlider = (UISlider *)sender; UIView *cell = (UIView *)theSlider.

Superview; UILabel *label=(UILabel*)cell viewWithTag:22; NSLog(@"label value is : %@ \n\n",label. Text); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions