So the younger brother this practice is in Scrllview inside put two tableview, and then through the scrollview of the sliding realization of two tableview, then add two button, to achieve the selected and unchecked, Then the associated button is sliding with the scrollview, and a simple example of changing the state is associated with the sliding button.
This small demo in the actual development will often encounter, so, the small partners can continue to do research and development according to this, continue to add new features, after all, the function of each product is not the same, we need to expand their own
Nonsense not much to say directly on the code
First create a ScrollView, and set its common properties
Uiscrollview *scrollview = [[Uiscrollview alloc] Initwithframe:cgrectmake (0, 0, 360, 444)]; Scrollview.backgroundcolor = [Uicolor Redcolor]; Scrollview.contentsize = Cgsizemake (360 * 2, 0); scrollview.pagingenabled = YES; Scrollview.delegate = self; Self.scrollview = ScrollView; [Self.view Addsubview:scrollview];
Next, create two Tablview and set their common properties
UITableView *lefttableview = [[UITableView alloc] Initwithframe:cgrectmake (0, 0, 444) Style:uitableviewstyleplain] ; [Lefttableview Registerclass:[uitableviewcell class] forcellreuseidentifier:leftcellidentify]; Lefttableview.datasource = self; Lefttableview.delegate = self; [ScrollView Addsubview:lefttableview];
Then get two buttons and set their common properties
UIButton *leftbutton = [UIButton buttonwithtype:uibuttontypecustom]; Leftbutton.frame = CGRectMake (120, 500, 50, 50); [LeftButton settitle:@ "left" forstate:uicontrolstatenormal]; Leftbutton.backgroundcolor = [Uicolor Bluecolor]; [LeftButton addtarget:self Action: @selector (Changeleftactionbutton:) forcontrolevents:uicontroleventtouchupinside ]; [Self.view Addsubview:leftbutton];
How to associate a button
-(void) Changerightactionbutton: (UIButton *) button {[UIView animatewithduration:0.3 animations:^{[Self.scrollvi EW Setcontentoffset:cgpointmake (360, 0)]; }];}
The delegate method of association ScrollView
-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView {}
Well, just write it here, it is only printed a way, as for the subsequent implementation and relevance, but also the small partners to operate their own implementation oh, come on
This article is from the "Neusoft iOS Alumni Group Technology Blog" blog, please be sure to keep this source http://neusoftios.blog.51cto.com/9977509/1638693
Intermediate Seventh issue: ScrollView common practice