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

View Single Post
Old 02-20-2009, 02:17 PM   #5 (permalink)
dietrichuhl
New Member
 
Join Date: Feb 2009
Location: Mississippi
Posts: 30
dietrichuhl is on a distinguished road
Default

Okay I’m trying to use the code. Thanks for posting it.
I built a new project that is a view controller type.
My .h is as follows
Code:
#import <UIKit/UIKit.h>

@interface sliderSwitchViewController : UIViewController {

	UISlider *customSlider;
	
}
- (void)create_Custom_UISlider;

@end

My .m is as follows
Code:
#import "sliderSwitchViewController.h"

@implementation sliderSwitchViewController

- (void)create_Custom_UISlider
{
	CGRect frame = CGRectMake(0.0, 0.0, 300, 52.0);
	CGRect thumb = CGRectMake(0.0, 0.0, 71.0, 47.0);
	customSlider = [[UISlider alloc] initWithFrame:frame];
	[customSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
	// in case the parent view draws with a custom color or gradient, use a transparent color
	customSlider.backgroundColor = [UIColor clearColor];	
	UIImage *stetchLeftTrack = [[UIImage imageNamed:@"customTrack.png"]
								stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
	UIImage *stetchRightTrack = [[UIImage imageNamed:@"customTrack.png"]
								 stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
	[customSlider setThumbImage: [UIImage imageNamed:@"customThumb.png"] forState:UIControlStateNormal];
	[customSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
	[customSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
	[customSlider thumbRectForBounds: thumb trackRect: frame value: customSlider.value];
	customSlider.minimumValue = 0.0;
	customSlider.maximumValue = 100.0;
	customSlider.continuous = NO;
	customSlider.value = 5.0;
}



// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
	[self create_Custom_UISlider];

}
I checked and I do have the correctly named images in the resources folder.
It does not work.
My expectation is that it should just place the slider on the screen.
Any thoughts?
Thanks
D
dietrichuhl is offline   Reply With Quote
 

» Advertisements
» Online Users: 439
18 members and 421 guests
7twenty7, ArthurOff, baja_yu, BdR, BumChinBooth, dansparrow, Duncan C, ioani, jeroenkeij, n00b, nyoe, QuantumDoja, rraagg, TheStalker, TheTakeOver, WeaselPig, Wikiboo, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,634
Threads: 94,093
Posts: 402,792
Top Poster: BrianSlick (7,990)
Welcome to our newest member, nyoe
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:55 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.