simple slider control implementation in iphone

Leave a Comment
Slider control implementation in iphone. In this demo slider control is used to increment values in iphone. Here code snippets and also source code is provided.

Header file
devangViewController .h


#import <UIKit/UIKit.h>
@interface devangViewController : UIViewController
- (IBAction)slidermove:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *lbl_slider;
@end
devangViewController .m implementation file

 #import "devangViewController.h"

@interface devangViewController ()
@end
@implementation devangViewController
@synthesize lbl_slider;
- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)slidermove:(id)sender {
    UISlider *slider = (UISlider *) sender;
    int progressAsInt =(int)(slider.value + 0.5f);
    NSString *newText =[[NSString alloc]
                        initWithFormat:@"%d",progressAsInt];
    self.lbl_slider.text = newText;
}
@end
I hope you are clear with this demo tutorial.

Output:


Demo Source Code

0 comments:

Post a Comment