TPBottomLockBar

From iPhone Development Wiki
Jump to: navigation, search

TPBottomLockBar is a UIView subclass providing the handful of action sliders in SpringBoard.

Subclassing

@interface MyBottomLockBar: TPBottomLockBar
@end
@implementation MyBottomLockBar
+ (float)defaultLabelFontSize {
	//default font size for the label
	return 20.0f;
}

- (id)initWithFrame:(CGRect)frame knobImage:(UIImage *)knobImage  {
	if((self = [super initWithFrame:frame knobImage:knobImage]) != nil) {
		
	} return self;
}

- (BOOL)allowsTouchTrackingBeyondVerticalThreshold {
	//allows for continuation of tracking if the UITouch strays outside the view
	return YES;
}

- (BOOL)usesBackgroundImage {
	//Use the default background image, the background to the slide to unlock view on the lock screen
	return NO;
}

- (void)unlock {
	//When the user has completed the unlock gesture
}

- (id)wellImageName {
	// the well image that the knob slides in, images are inside of the TelephonyUI.framework
	//this is the background image used in the notifications on the lockscreen
	return @"BulletinWellLock";
}

- (float)knobTrackInsetLeft {
	//set the inset of where the knob view starts, based off it's superview
	return 18.0f;
}

- (float)knobTrackInsetRight {
	//set the where the knob finishes, when it slides all the way
	return 18.0f;
}

- (float)_calcKnobYOffset {
	// move the knob up or down
	return 0.0f;
}

- (void)downInKnob {
	//When the user presses down on the knob
}

- (void)upInKnob {
	//user lifts up on knob
}
@end

Miscellany

The text label includes features such as the animating text and cycling through multiple text labels.

TPBottomLockBar *myTPBottomLockBar = [[TPBottomLockBar alloc] initWithFrame:CGRectZero knobImage:nil];

// Single Label
[myTPBottomLockBar setLabel:@"blah blah blah"];

// Multiple Labels
[myTPBottomLockBar setLabels:[NSArray arrayWithObjects:@"Label 1",@"Label 2", @"Label 3",nil]];

// Cycling Labels
[myTPBottomLockBar startCyclingLabels];

[myTPBottomLockBar stopCyclingLabels];

[myTPBottomLockBar cycleToNextLabel];

[myTPBottomLockBar cycleToLabelAtIndex:index];

// Text Animation
[myTPBottomLockBar startAnimating];

[myTPBottomLockBar stopAnimating];

// Change Font Size
[myTPBottomLockBar setFontSize:20.0f];