Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-25-2009, 01:15 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 20
cation007 is on a distinguished road
Unhappy Problem with custom UITableViewCell and UISliders

Hi,

I have a table view with custom UITableViewCell.

Each cell has a UILabel and a UISlider.

I would like to update the UILabel when UISlider is moved.

I tried doing it but I could not get it change smooth
How can I do that ?

Also, I am using their tag numbers to identify the cell on which the action occurs. Is there any other clean way to do it ?

Thanks for replying.
cation007 is offline   Reply With Quote
Old 08-19-2011, 06:35 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 12
Soniya is on a distinguished road
Default Changing UILabel text with UISlider value in Custom cell

I know this ques was asked 2 years back but I am replying so that other can utilize it:

So here is solution for this

In cellForRowAtIndexPath

cell.slid[COLOR="rgb(0, 100, 0)"]er.tag=800+[indexPath row];


cell.slider.maximumValue = 100;
cell.slider.minimumValue = 1;
cell.slider.continuous = TRUE;
cell.slider.value=[cell.mylabel.text intValue];
[cell.slider addTarget:self action:@selector(sliderChanged forControlEvents:UIControlEventValueChanged];

cell.tag=900+[indexPath row];
[/color]

where sliderChanged: is defined as

-(void)sliderChangedUISlider *)slider
{
CustomCell *cell= (CustomCell *)[[self tvMain] viewWithTagslider.tag+100)];
cell.mylabel.text = [NSString stringWithFormat:@"%d", (int)slider.value];
}


//tvMain is outlet connected to UITableview if you have UIViewController. If you are using UITableviewController then you can use [self tableview]

if you want to make these changes in array then you can replace old value with new value in UILabel using

NSInteger rowindex=(slider.tag-800);

as your index number

hope this works for all.
Soniya is offline   Reply With Quote
Reply

Bookmarks

Tags
uilabel, uislider, uitableviewcell, update the content

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 319
11 members and 308 guests
chiataytuday, coolman, givensur, guusleijsten, ipodphone, jbro, mediaspree, mottdog, mtl_tech_guy, Punkjumper, vilisei
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,882
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0