Vignesh
Vignesh

Reputation: 644

iOS - How to set up an Custom class to the control programmatically

Am having and UISlider that i have created programmatically i would like to customise the UISlider appearance so i user used some UISlider custom class.

Is it possible to set up an custom class to the UISlider control programmatically without storyboard

enter image description here

Upvotes: 1

Views: 651

Answers (1)

Md. Ibrahim Hassan
Md. Ibrahim Hassan

Reputation: 5467

First:

#import "JMMarkSlider.h";

Then declare a property like a normal property declaration:

@property (weak, nonatomic) IBOutlet JMMarkSlider *firstSlider;

Then Declare the frame and add to View as for a normal UI element:

 self.firstSlider=[[JMMarkSlider alloc]initWithFrame:CGRectMake(x,y,width,height)];

Add any DataSource and Delegate to the ViewController.h file.

Hope this helps.

Upvotes: 1

Related Questions