[Code Note] iOS-slide options between left and right, and code note ios-slide
I ,.
2. Engineering Drawing.
3. Code.
RootViewController. h
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController@end
RootViewController. m
# Import "RootViewController. h "// introduce the header file # import" SVSegmentedControl. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // initialize the background image [self initBackgroundView];} # pragma-makr-funcitons-(void) initBackgroundView {SVSegmentedControl * options = [[SVSegmentedControl alloc] direction: [NSArray setting: @ "car purchase application", @ "car owner application", nil]; options. center = CGPointMake (160,100); [options setSelectedSegmentIndex: 0 animated: NO]; [options addTarget: self action: @ selector (segmentedControlChangedValue :) forControlEvents: UIControlEventValueChanged]; [self. view addSubview: options] ;}# pragma-mark-doClickAction-(void) segmentedControlChangedValue :( SVSegmentedControl *) segmentedControl {NSLog (@ "-- index -- % I-", segmentedControl. selectedSegmentIndex);}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .}