├── Class ├── DXSemiTableViewController.h ├── DXSemiTableViewController.m ├── DXSemiViewController.h ├── DXSemiViewController.m ├── DXSemiViewControllerCategory.h └── DXSemiViewControllerCategory.m ├── DXSemiSideDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── DXSemiSideDemo.xccheckout ├── DXSemiSideDemo ├── DXAppDelegate.h ├── DXAppDelegate.m ├── DXRootViewController.h ├── DXRootViewController.m ├── DXSemiSideDemo-Info.plist ├── DXSemiSideDemo-Prefix.pch ├── DXSubClassSemiViewController.h ├── DXSubClassSemiViewController.m ├── DXSubclassSemiTableViewController.h ├── DXSubclassSemiTableViewController.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── en.lproj │ └── InfoPlist.strings └── main.m ├── Default-568h@2x.png └── README.md /Class/DXSemiTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXSemiTableViewController.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-8. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DXSemiViewController.h" 12 | 13 | @interface DXSemiTableViewController : DXSemiViewController 14 | { 15 | CGFloat _currentMaxDisplayedSection; 16 | CGFloat _currentMaxDisplayedCell; 17 | } 18 | 19 | @property (nonatomic, strong) UITableView *semiTableView; 20 | @property (nonatomic, strong) UILabel *semiTitleLabel; 21 | @property (nonatomic, strong) NSMutableArray *dateSourceArray; 22 | 23 | @property (nonatomic, assign) CGFloat titleLabelHeight; 24 | @property (nonatomic, assign) CGFloat cellAnimationDuration; 25 | @property (nonatomic, assign) CGFloat tableViewRowHeight; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Class/DXSemiTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXSemiTableViewController.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-8. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXSemiTableViewController.h" 10 | #import 11 | 12 | @interface DXSemiTableViewController () 13 | 14 | @end 15 | 16 | @implementation DXSemiTableViewController 17 | 18 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 19 | { 20 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 21 | if (self) { 22 | // Custom initialization 23 | } 24 | return self; 25 | } 26 | 27 | - (id)init 28 | { 29 | if (self = [super init]) { 30 | self.titleLabelHeight = 44.0f; 31 | self.cellAnimationDuration = 0.7f; 32 | self.tableViewRowHeight = 44.0f; 33 | self.dateSourceArray = [NSMutableArray array]; 34 | self.semiTitleLabel = [[UILabel alloc] init]; 35 | self.semiTitleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; 36 | self.semiTableView = [[UITableView alloc] init]; 37 | self.semiTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)viewDidLoad 43 | { 44 | [super viewDidLoad]; 45 | self.semiTitleLabel.frame = CGRectMake(0, 0, CGRectGetWidth(self.contentView.bounds), self.titleLabelHeight); 46 | self.semiTitleLabel.backgroundColor = [UIColor whiteColor]; 47 | self.semiTitleLabel.textAlignment = NSTextAlignmentCenter; 48 | [self.contentView addSubview:self.semiTitleLabel]; 49 | 50 | self.semiTableView.frame = CGRectMake(0, CGRectGetMaxY(self.semiTitleLabel.frame), CGRectGetWidth(self.contentView.bounds), CGRectGetHeight(self.contentView.bounds) - self.titleLabelHeight); 51 | [self.contentView addSubview:self.semiTableView]; 52 | self.semiTableView.dataSource = self; 53 | self.semiTableView.delegate = self; 54 | self.semiTableView.rowHeight = self.tableViewRowHeight; 55 | } 56 | 57 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 58 | { 59 | return 1; 60 | } 61 | 62 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 63 | { 64 | return self.dateSourceArray.count; 65 | } 66 | 67 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 68 | { 69 | return nil; 70 | } 71 | 72 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 73 | { 74 | if (indexPath.section <= _currentMaxDisplayedSection && indexPath.row <= _currentMaxDisplayedCell) { 75 | return; 76 | } 77 | 78 | NSInteger baseRows = ceilf(CGRectGetHeight(self.semiTableView.bounds) / self.tableViewRowHeight) - 1; 79 | 80 | CGFloat delay = indexPath.row <= baseRows ? 0.05f * indexPath.row : 0.01f; 81 | 82 | switch (self.direction) { 83 | case SemiViewControllerDirectionRight: { 84 | cell.contentView.layer.transform = CATransform3DMakeRotation(90.0f, 0, 1, 0); 85 | cell.contentView.layer.anchorPoint = CGPointMake(1, 0.5); 86 | } 87 | break; 88 | case SemiViewControllerDirectionLeft: { 89 | cell.contentView.layer.transform = CATransform3DMakeRotation(-90.0f, 0, 1, 0); 90 | cell.contentView.layer.anchorPoint = CGPointMake(0.0, 0.5); 91 | } 92 | } 93 | 94 | [self.semiTableView bringSubviewToFront:cell.contentView]; 95 | [UIView animateWithDuration:self.cellAnimationDuration 96 | delay:delay 97 | options:UIViewAnimationOptionAllowUserInteraction 98 | animations:^{ 99 | //clear the transform 100 | cell.contentView.layer.transform = CATransform3DMakeRotation(0, 0, 0, 0); 101 | } completion:nil]; 102 | _currentMaxDisplayedCell = indexPath.row; 103 | _currentMaxDisplayedSection = indexPath.section; 104 | } 105 | 106 | - (BOOL)isScreen568 107 | { 108 | return CGRectGetHeight(self.view.bounds) - 480.0f > 0.1f; 109 | } 110 | 111 | - (void)didReceiveMemoryWarning 112 | { 113 | [super didReceiveMemoryWarning]; 114 | // Dispose of any resources that can be recreated. 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Class/DXSemiViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXSemiViewController.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | SemiViewControllerDirectionLeft, 13 | SemiViewControllerDirectionRight, 14 | }SemiViewControllerDirection; 15 | 16 | @interface DXSemiViewController : UIViewController 17 | 18 | @property (nonatomic, assign) SemiViewControllerDirection direction; 19 | @property (nonatomic, assign) CGFloat sideAnimationDuration; 20 | @property (nonatomic, assign) CGFloat sideOffset; 21 | 22 | @property (nonatomic, strong) UIView *contentView; 23 | 24 | 25 | - (void)dismissSemi:(id)sender; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Class/DXSemiViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXSemiViewController.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXSemiViewController.h" 10 | 11 | @interface DXSemiViewController () 12 | 13 | @end 14 | 15 | @implementation DXSemiViewController 16 | 17 | - (id)init 18 | { 19 | if (self = [super init]) { 20 | self.sideAnimationDuration = 0.3f; 21 | self.sideOffset = 50.0f; 22 | } 23 | return self; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | self.view.backgroundColor = [UIColor clearColor]; 30 | self.contentView = [[UIView alloc] init]; 31 | self.contentView.backgroundColor = [UIColor clearColor]; 32 | 33 | UIView *anotherView = [[UIView alloc] init]; 34 | anotherView.backgroundColor = [UIColor clearColor]; 35 | anotherView.userInteractionEnabled = YES; 36 | 37 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissSemi:)]; 38 | 39 | UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(dismissSemi:)]; 40 | 41 | CGRect selfViewFrame = self.view.bounds; 42 | if (self.direction == SemiViewControllerDirectionLeft) { 43 | selfViewFrame.size.width = CGRectGetWidth(selfViewFrame) - self.sideOffset; 44 | self.contentView.frame = selfViewFrame; 45 | self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin; 46 | anotherView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 47 | 48 | selfViewFrame.size.width = self.sideOffset; 49 | selfViewFrame.origin.x = CGRectGetMaxX(self.contentView.frame); 50 | anotherView.frame = selfViewFrame; 51 | 52 | swipe.direction = UISwipeGestureRecognizerDirectionLeft; 53 | 54 | }else if (self.direction == SemiViewControllerDirectionRight) { 55 | selfViewFrame.size.width = CGRectGetWidth(selfViewFrame) - self.sideOffset; 56 | selfViewFrame.origin.x = self.sideOffset; 57 | self.contentView.frame = selfViewFrame; 58 | self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin; 59 | 60 | 61 | selfViewFrame.origin.x = CGRectGetMinX(self.view.bounds); 62 | selfViewFrame.size.width = self.sideOffset; 63 | anotherView.frame = selfViewFrame; 64 | 65 | swipe.direction = UISwipeGestureRecognizerDirectionRight; 66 | } 67 | 68 | [self.view addSubview:self.contentView]; 69 | [self.view addSubview:anotherView]; 70 | [anotherView addGestureRecognizer:tap]; 71 | [self.view addGestureRecognizer:swipe]; 72 | } 73 | 74 | - (void)willMoveToParentViewController:(UIViewController *)parent 75 | { 76 | [UIView animateWithDuration:self.sideAnimationDuration animations:^{ 77 | CGRect selfViewFrame = self.view.frame; 78 | selfViewFrame.origin.x = 0.0f; 79 | self.view.frame = selfViewFrame; 80 | } completion:^(BOOL finished) { 81 | [super willMoveToParentViewController:parent]; 82 | }]; 83 | } 84 | 85 | - (void)dismissSemi:(id)sender 86 | { 87 | [self willMoveToParentViewController:nil]; 88 | CGRect pareViewRect = self.parentViewController.view.bounds; 89 | CGFloat originX = 0; 90 | 91 | switch (self.direction) { 92 | case SemiViewControllerDirectionLeft: 93 | originX -= CGRectGetWidth(pareViewRect); 94 | break; 95 | case SemiViewControllerDirectionRight: 96 | originX += CGRectGetWidth(pareViewRect); 97 | } 98 | 99 | [UIView animateWithDuration:self.sideAnimationDuration animations:^{ 100 | self.view.frame = CGRectMake(originX, CGRectGetMinY(pareViewRect), CGRectGetWidth(pareViewRect), CGRectGetHeight(pareViewRect)); 101 | } completion:^(BOOL finished) { 102 | [self.view removeFromSuperview]; 103 | }]; 104 | [self removeFromParentViewController]; 105 | } 106 | 107 | 108 | - (void)didReceiveMemoryWarning 109 | { 110 | [super didReceiveMemoryWarning]; 111 | // Dispose of any resources that can be recreated. 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /Class/DXSemiViewControllerCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXSemiViewControllerCategory.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DXSemiViewController; 12 | 13 | @interface UIViewController (SemiViewController) 14 | 15 | @property (nonatomic, strong) DXSemiViewController *leftSemiViewController; 16 | @property (nonatomic, strong) DXSemiViewController *rightSemiViewController; 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Class/DXSemiViewControllerCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXSemiViewControllerCategory.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXSemiViewControllerCategory.h" 10 | #import "DXSemiViewController.h" 11 | 12 | @implementation UIViewController (SemiViewController) 13 | 14 | @dynamic leftSemiViewController; 15 | @dynamic rightSemiViewController; 16 | 17 | 18 | - (void)setLeftSemiViewController:(DXSemiViewController *)semiLeftVC 19 | { 20 | [self setSemiViewController:semiLeftVC withDirection:SemiViewControllerDirectionLeft]; 21 | } 22 | 23 | - (void)setRightSemiViewController:(DXSemiViewController *)semiRightVC 24 | { 25 | [self setSemiViewController:semiRightVC withDirection:SemiViewControllerDirectionRight]; 26 | } 27 | 28 | - (void)setSemiViewController:(DXSemiViewController *)semiVC withDirection:(SemiViewControllerDirection)direction 29 | { 30 | semiVC.direction = direction; 31 | CGRect selfFrame = self.view.bounds; 32 | switch (direction) { 33 | case SemiViewControllerDirectionRight: 34 | selfFrame.origin.x += selfFrame.size.width; 35 | break; 36 | case SemiViewControllerDirectionLeft: 37 | selfFrame.origin.x -= selfFrame.size.width; 38 | break; 39 | } 40 | semiVC.view.frame = selfFrame; 41 | 42 | /* overlayView if necessory */ 43 | /* 44 | UIView *overLayView = [[UIView alloc] initWithFrame:self.view.bounds]; 45 | overLayView.backgroundColor = [UIColor blackColor]; 46 | overLayView.alpha = 0.8; 47 | [self.view addSubview:overLayView]; 48 | */ 49 | 50 | [self.view addSubview:semiVC.view]; 51 | [self addChildViewController:semiVC]; 52 | [semiVC willMoveToParentViewController:self]; 53 | } 54 | 55 | 56 | @end -------------------------------------------------------------------------------- /DXSemiSideDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BE5891081789D58F001E07CC /* DXSemiTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE5891031789D58F001E07CC /* DXSemiTableViewController.m */; }; 11 | BE5891091789D58F001E07CC /* DXSemiViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE5891051789D58F001E07CC /* DXSemiViewController.m */; }; 12 | BE58910A1789D58F001E07CC /* DXSemiViewControllerCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = BE5891071789D58F001E07CC /* DXSemiViewControllerCategory.m */; }; 13 | BE7AE54D1789B07500390175 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE7AE54C1789B07500390175 /* Foundation.framework */; }; 14 | BE7AE54F1789B07500390175 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE7AE54E1789B07500390175 /* CoreGraphics.framework */; }; 15 | BE7AE5511789B07500390175 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE7AE5501789B07500390175 /* UIKit.framework */; }; 16 | BE7AE5571789B07500390175 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = BE7AE5551789B07500390175 /* InfoPlist.strings */; }; 17 | BE7AE5591789B07500390175 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BE7AE5581789B07500390175 /* main.m */; }; 18 | BE7AE55D1789B07500390175 /* DXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BE7AE55C1789B07500390175 /* DXAppDelegate.m */; }; 19 | BE7AE55F1789B07500390175 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE7AE55E1789B07500390175 /* Images.xcassets */; }; 20 | BE7AE57C1789B0A000390175 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE7AE57B1789B0A000390175 /* QuartzCore.framework */; }; 21 | BE7AE5871789B7F800390175 /* DXRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE7AE5861789B7F800390175 /* DXRootViewController.m */; }; 22 | BEDF29501789C46F005AEB75 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = BEDF294F1789C46F005AEB75 /* Default-568h@2x.png */; }; 23 | BEDF29531789C795005AEB75 /* DXSubClassSemiViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEDF29521789C795005AEB75 /* DXSubClassSemiViewController.m */; }; 24 | BEDF29591789CE11005AEB75 /* DXSubclassSemiTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEDF29581789CE11005AEB75 /* DXSubclassSemiTableViewController.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | BE5891021789D58F001E07CC /* DXSemiTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DXSemiTableViewController.h; sourceTree = ""; }; 29 | BE5891031789D58F001E07CC /* DXSemiTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DXSemiTableViewController.m; sourceTree = ""; }; 30 | BE5891041789D58F001E07CC /* DXSemiViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DXSemiViewController.h; sourceTree = ""; }; 31 | BE5891051789D58F001E07CC /* DXSemiViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DXSemiViewController.m; sourceTree = ""; }; 32 | BE5891061789D58F001E07CC /* DXSemiViewControllerCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DXSemiViewControllerCategory.h; sourceTree = ""; }; 33 | BE5891071789D58F001E07CC /* DXSemiViewControllerCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DXSemiViewControllerCategory.m; sourceTree = ""; }; 34 | BE7AE5491789B07500390175 /* DXSemiSideDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DXSemiSideDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | BE7AE54C1789B07500390175 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 36 | BE7AE54E1789B07500390175 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 37 | BE7AE5501789B07500390175 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 38 | BE7AE5541789B07500390175 /* DXSemiSideDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DXSemiSideDemo-Info.plist"; sourceTree = ""; }; 39 | BE7AE5561789B07500390175 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 40 | BE7AE5581789B07500390175 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | BE7AE55A1789B07500390175 /* DXSemiSideDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DXSemiSideDemo-Prefix.pch"; sourceTree = ""; }; 42 | BE7AE55B1789B07500390175 /* DXAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXAppDelegate.h; sourceTree = ""; }; 43 | BE7AE55C1789B07500390175 /* DXAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXAppDelegate.m; sourceTree = ""; }; 44 | BE7AE55E1789B07500390175 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 45 | BE7AE5651789B07500390175 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 46 | BE7AE57B1789B0A000390175 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 47 | BE7AE5851789B7F800390175 /* DXRootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DXRootViewController.h; sourceTree = ""; }; 48 | BE7AE5861789B7F800390175 /* DXRootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DXRootViewController.m; sourceTree = ""; }; 49 | BEDF294F1789C46F005AEB75 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../Default-568h@2x.png"; sourceTree = ""; }; 50 | BEDF29511789C795005AEB75 /* DXSubClassSemiViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DXSubClassSemiViewController.h; sourceTree = ""; }; 51 | BEDF29521789C795005AEB75 /* DXSubClassSemiViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DXSubClassSemiViewController.m; sourceTree = ""; }; 52 | BEDF29571789CE11005AEB75 /* DXSubclassSemiTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DXSubclassSemiTableViewController.h; sourceTree = ""; }; 53 | BEDF29581789CE11005AEB75 /* DXSubclassSemiTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DXSubclassSemiTableViewController.m; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | BE7AE5461789B07500390175 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | BE7AE57C1789B0A000390175 /* QuartzCore.framework in Frameworks */, 62 | BE7AE54F1789B07500390175 /* CoreGraphics.framework in Frameworks */, 63 | BE7AE5511789B07500390175 /* UIKit.framework in Frameworks */, 64 | BE7AE54D1789B07500390175 /* Foundation.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | BE5891011789D58F001E07CC /* Class */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | BE5891021789D58F001E07CC /* DXSemiTableViewController.h */, 75 | BE5891031789D58F001E07CC /* DXSemiTableViewController.m */, 76 | BE5891041789D58F001E07CC /* DXSemiViewController.h */, 77 | BE5891051789D58F001E07CC /* DXSemiViewController.m */, 78 | BE5891061789D58F001E07CC /* DXSemiViewControllerCategory.h */, 79 | BE5891071789D58F001E07CC /* DXSemiViewControllerCategory.m */, 80 | ); 81 | path = Class; 82 | sourceTree = ""; 83 | }; 84 | BE7AE5401789B07500390175 = { 85 | isa = PBXGroup; 86 | children = ( 87 | BE5891011789D58F001E07CC /* Class */, 88 | BE7AE5521789B07500390175 /* DXSemiSideDemo */, 89 | BE7AE54B1789B07500390175 /* Frameworks */, 90 | BE7AE54A1789B07500390175 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | BE7AE54A1789B07500390175 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | BE7AE5491789B07500390175 /* DXSemiSideDemo.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | BE7AE54B1789B07500390175 /* Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | BE7AE57B1789B0A000390175 /* QuartzCore.framework */, 106 | BE7AE54C1789B07500390175 /* Foundation.framework */, 107 | BE7AE54E1789B07500390175 /* CoreGraphics.framework */, 108 | BE7AE5501789B07500390175 /* UIKit.framework */, 109 | BE7AE5651789B07500390175 /* XCTest.framework */, 110 | ); 111 | name = Frameworks; 112 | sourceTree = ""; 113 | }; 114 | BE7AE5521789B07500390175 /* DXSemiSideDemo */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | BEDF29571789CE11005AEB75 /* DXSubclassSemiTableViewController.h */, 118 | BEDF29581789CE11005AEB75 /* DXSubclassSemiTableViewController.m */, 119 | BEDF29511789C795005AEB75 /* DXSubClassSemiViewController.h */, 120 | BEDF29521789C795005AEB75 /* DXSubClassSemiViewController.m */, 121 | BE7AE5851789B7F800390175 /* DXRootViewController.h */, 122 | BE7AE5861789B7F800390175 /* DXRootViewController.m */, 123 | BE7AE55B1789B07500390175 /* DXAppDelegate.h */, 124 | BE7AE55C1789B07500390175 /* DXAppDelegate.m */, 125 | BE7AE55E1789B07500390175 /* Images.xcassets */, 126 | BE7AE5531789B07500390175 /* Supporting Files */, 127 | ); 128 | path = DXSemiSideDemo; 129 | sourceTree = ""; 130 | }; 131 | BE7AE5531789B07500390175 /* Supporting Files */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | BEDF294F1789C46F005AEB75 /* Default-568h@2x.png */, 135 | BE7AE5541789B07500390175 /* DXSemiSideDemo-Info.plist */, 136 | BE7AE5551789B07500390175 /* InfoPlist.strings */, 137 | BE7AE5581789B07500390175 /* main.m */, 138 | BE7AE55A1789B07500390175 /* DXSemiSideDemo-Prefix.pch */, 139 | ); 140 | name = "Supporting Files"; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | BE7AE5481789B07500390175 /* DXSemiSideDemo */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = BE7AE5751789B07500390175 /* Build configuration list for PBXNativeTarget "DXSemiSideDemo" */; 149 | buildPhases = ( 150 | BE7AE5451789B07500390175 /* Sources */, 151 | BE7AE5461789B07500390175 /* Frameworks */, 152 | BE7AE5471789B07500390175 /* Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = DXSemiSideDemo; 159 | productName = DXSemiSideDemo; 160 | productReference = BE7AE5491789B07500390175 /* DXSemiSideDemo.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | BE7AE5411789B07500390175 /* Project object */ = { 167 | isa = PBXProject; 168 | attributes = { 169 | CLASSPREFIX = DX; 170 | LastUpgradeCheck = 0500; 171 | ORGANIZATIONNAME = "谢 凯伟"; 172 | }; 173 | buildConfigurationList = BE7AE5441789B07500390175 /* Build configuration list for PBXProject "DXSemiSideDemo" */; 174 | compatibilityVersion = "Xcode 3.2"; 175 | developmentRegion = English; 176 | hasScannedForEncodings = 0; 177 | knownRegions = ( 178 | en, 179 | ); 180 | mainGroup = BE7AE5401789B07500390175; 181 | productRefGroup = BE7AE54A1789B07500390175 /* Products */; 182 | projectDirPath = ""; 183 | projectRoot = ""; 184 | targets = ( 185 | BE7AE5481789B07500390175 /* DXSemiSideDemo */, 186 | ); 187 | }; 188 | /* End PBXProject section */ 189 | 190 | /* Begin PBXResourcesBuildPhase section */ 191 | BE7AE5471789B07500390175 /* Resources */ = { 192 | isa = PBXResourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | BE7AE5571789B07500390175 /* InfoPlist.strings in Resources */, 196 | BE7AE55F1789B07500390175 /* Images.xcassets in Resources */, 197 | BEDF29501789C46F005AEB75 /* Default-568h@2x.png in Resources */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXResourcesBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | BE7AE5451789B07500390175 /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | BE58910A1789D58F001E07CC /* DXSemiViewControllerCategory.m in Sources */, 209 | BE5891091789D58F001E07CC /* DXSemiViewController.m in Sources */, 210 | BE7AE55D1789B07500390175 /* DXAppDelegate.m in Sources */, 211 | BE5891081789D58F001E07CC /* DXSemiTableViewController.m in Sources */, 212 | BE7AE5871789B7F800390175 /* DXRootViewController.m in Sources */, 213 | BE7AE5591789B07500390175 /* main.m in Sources */, 214 | BEDF29531789C795005AEB75 /* DXSubClassSemiViewController.m in Sources */, 215 | BEDF29591789CE11005AEB75 /* DXSubclassSemiTableViewController.m in Sources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXSourcesBuildPhase section */ 220 | 221 | /* Begin PBXVariantGroup section */ 222 | BE7AE5551789B07500390175 /* InfoPlist.strings */ = { 223 | isa = PBXVariantGroup; 224 | children = ( 225 | BE7AE5561789B07500390175 /* en */, 226 | ); 227 | name = InfoPlist.strings; 228 | sourceTree = ""; 229 | }; 230 | /* End PBXVariantGroup section */ 231 | 232 | /* Begin XCBuildConfiguration section */ 233 | BE7AE5731789B07500390175 /* Debug */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | ALWAYS_SEARCH_USER_PATHS = NO; 237 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 238 | CLANG_CXX_LIBRARY = "libc++"; 239 | CLANG_ENABLE_MODULES = YES; 240 | CLANG_ENABLE_OBJC_ARC = YES; 241 | CLANG_WARN_BOOL_CONVERSION = YES; 242 | CLANG_WARN_CONSTANT_CONVERSION = YES; 243 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 244 | CLANG_WARN_EMPTY_BODY = YES; 245 | CLANG_WARN_ENUM_CONVERSION = YES; 246 | CLANG_WARN_INT_CONVERSION = YES; 247 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 250 | COPY_PHASE_STRIP = NO; 251 | GCC_C_LANGUAGE_STANDARD = gnu99; 252 | GCC_DYNAMIC_NO_PIC = NO; 253 | GCC_OPTIMIZATION_LEVEL = 0; 254 | GCC_PREPROCESSOR_DEFINITIONS = ( 255 | "DEBUG=1", 256 | "$(inherited)", 257 | ); 258 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 260 | GCC_WARN_UNDECLARED_SELECTOR = YES; 261 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 262 | GCC_WARN_UNUSED_FUNCTION = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 265 | ONLY_ACTIVE_ARCH = YES; 266 | SDKROOT = iphoneos; 267 | TARGETED_DEVICE_FAMILY = "1,2"; 268 | }; 269 | name = Debug; 270 | }; 271 | BE7AE5741789B07500390175 /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ALWAYS_SEARCH_USER_PATHS = NO; 275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 276 | CLANG_CXX_LIBRARY = "libc++"; 277 | CLANG_ENABLE_MODULES = YES; 278 | CLANG_ENABLE_OBJC_ARC = YES; 279 | CLANG_WARN_BOOL_CONVERSION = YES; 280 | CLANG_WARN_CONSTANT_CONVERSION = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = YES; 289 | ENABLE_NS_ASSERTIONS = NO; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 297 | SDKROOT = iphoneos; 298 | TARGETED_DEVICE_FAMILY = "1,2"; 299 | VALIDATE_PRODUCT = YES; 300 | }; 301 | name = Release; 302 | }; 303 | BE7AE5761789B07500390175 /* Debug */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 308 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 309 | GCC_PREFIX_HEADER = "DXSemiSideDemo/DXSemiSideDemo-Prefix.pch"; 310 | INFOPLIST_FILE = "DXSemiSideDemo/DXSemiSideDemo-Info.plist"; 311 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | WRAPPER_EXTENSION = app; 314 | }; 315 | name = Debug; 316 | }; 317 | BE7AE5771789B07500390175 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 321 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 322 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 323 | GCC_PREFIX_HEADER = "DXSemiSideDemo/DXSemiSideDemo-Prefix.pch"; 324 | INFOPLIST_FILE = "DXSemiSideDemo/DXSemiSideDemo-Info.plist"; 325 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | WRAPPER_EXTENSION = app; 328 | }; 329 | name = Release; 330 | }; 331 | /* End XCBuildConfiguration section */ 332 | 333 | /* Begin XCConfigurationList section */ 334 | BE7AE5441789B07500390175 /* Build configuration list for PBXProject "DXSemiSideDemo" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | BE7AE5731789B07500390175 /* Debug */, 338 | BE7AE5741789B07500390175 /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | BE7AE5751789B07500390175 /* Build configuration list for PBXNativeTarget "DXSemiSideDemo" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | BE7AE5761789B07500390175 /* Debug */, 347 | BE7AE5771789B07500390175 /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | /* End XCConfigurationList section */ 353 | }; 354 | rootObject = BE7AE5411789B07500390175 /* Project object */; 355 | } 356 | -------------------------------------------------------------------------------- /DXSemiSideDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DXSemiSideDemo.xcodeproj/project.xcworkspace/xcshareddata/DXSemiSideDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectIdentifier 6 | 620C295E-920B-4BC7-A82F-4526B5404D05 7 | IDESourceControlProjectName 8 | DXSemiSideDemo 9 | IDESourceControlProjectOriginsDictionary 10 | 11 | 63385F08-35A7-4D9B-977C-42C94B684F9F 12 | https://github.com/xiekw2010/DXSemiViewController.git 13 | 14 | IDESourceControlProjectPath 15 | DXSemiSideDemo.xcodeproj/project.xcworkspace 16 | IDESourceControlProjectRelativeInstallPathDictionary 17 | 18 | 63385F08-35A7-4D9B-977C-42C94B684F9F 19 | ../.. 20 | 21 | IDESourceControlProjectURL 22 | https://github.com/xiekw2010/DXSemiViewController.git 23 | IDESourceControlProjectVersion 24 | 110 25 | IDESourceControlProjectWCCIdentifier 26 | 63385F08-35A7-4D9B-977C-42C94B684F9F 27 | IDESourceControlProjectWCConfigurations 28 | 29 | 30 | IDESourceControlRepositoryExtensionIdentifierKey 31 | public.vcs.git 32 | IDESourceControlWCCIdentifierKey 33 | 63385F08-35A7-4D9B-977C-42C94B684F9F 34 | IDESourceControlWCCName 35 | DXSemiViewController 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXAppDelegate.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DXAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXAppDelegate.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXAppDelegate.h" 10 | #import "DXRootViewController.h" 11 | 12 | @implementation DXAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | DXRootViewController *rvc = [[DXRootViewController alloc] initWithNibName:nil bundle:nil]; 18 | self.window.rootViewController = rvc; 19 | self.window.backgroundColor = [UIColor whiteColor]; 20 | [self.window makeKeyAndVisible]; 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 27 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 38 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application 42 | { 43 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXRootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXRootViewController.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DXRootViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXRootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXRootViewController.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXRootViewController.h" 10 | #import "DXSemiViewControllerCategory.h" 11 | #import "DXSubClassSemiViewController.h" 12 | #import "DXSubclassSemiTableViewController.h" 13 | 14 | @interface DXRootViewController () 15 | 16 | @end 17 | 18 | @implementation DXRootViewController 19 | 20 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 21 | { 22 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 23 | if (self) { 24 | // Custom initialization 25 | } 26 | return self; 27 | } 28 | 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | 33 | self.view.backgroundColor = [UIColor purpleColor]; 34 | 35 | UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 36 | [leftBtn setTitle:@"ShowLeft" forState:UIControlStateNormal]; 37 | [leftBtn setBackgroundColor:[UIColor redColor]]; 38 | leftBtn.frame = CGRectMake((CGRectGetWidth(self.view.bounds) - 200) * 0.5, 20, 200, 50); 39 | [self.view addSubview:leftBtn]; 40 | [leftBtn addTarget:self action:@selector(showLeftSemi:) forControlEvents:UIControlEventTouchUpInside]; 41 | 42 | UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 43 | [rightBtn setTitle:@"ShowRight" forState:UIControlStateNormal]; 44 | [rightBtn setBackgroundColor:[UIColor redColor]]; 45 | rightBtn.frame = CGRectMake(CGRectGetMinX(leftBtn.frame), 90, 200, 50); 46 | [self.view addSubview:rightBtn]; 47 | [rightBtn addTarget:self action:@selector(showRightSemi:) forControlEvents:UIControlEventTouchUpInside]; 48 | 49 | UIButton *leftTable = [UIButton buttonWithType:UIButtonTypeCustom]; 50 | [leftTable setTitle:@"ShowLeftTableSemi" forState:UIControlStateNormal]; 51 | [leftTable setBackgroundColor:[UIColor redColor]]; 52 | leftTable.frame = CGRectMake(CGRectGetMinX(leftBtn.frame), 160, 200, 50); 53 | [self.view addSubview:leftTable]; 54 | [leftTable addTarget:self action:@selector(showLeftTableSemi:) forControlEvents:UIControlEventTouchUpInside]; 55 | 56 | UIButton *rightTable = [UIButton buttonWithType:UIButtonTypeCustom]; 57 | [rightTable setTitle:@"ShowLeftTableSemi" forState:UIControlStateNormal]; 58 | [rightTable setBackgroundColor:[UIColor redColor]]; 59 | rightTable.frame = CGRectMake(CGRectGetMinX(leftBtn.frame), 230, 200, 50); 60 | [self.view addSubview:rightTable]; 61 | [rightTable addTarget:self action:@selector(showrightTableSemi:) forControlEvents:UIControlEventTouchUpInside]; 62 | 63 | leftBtn.autoresizingMask = rightBtn.autoresizingMask = leftTable.autoresizingMask = rightTable.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin; 64 | } 65 | 66 | - (void)showLeftSemi:(id)sender 67 | { 68 | DXSubClassSemiViewController *semiLeft = [[DXSubClassSemiViewController alloc] init]; 69 | self.leftSemiViewController = semiLeft; 70 | } 71 | 72 | - (void)showRightSemi:(id)sender 73 | { 74 | DXSubClassSemiViewController *semiRight = [[DXSubClassSemiViewController alloc] init]; 75 | self.rightSemiViewController = semiRight; 76 | } 77 | 78 | - (void)showLeftTableSemi:(id)sender 79 | { 80 | DXSubclassSemiTableViewController *semiLeft = [[DXSubclassSemiTableViewController alloc] init]; 81 | semiLeft.semiTitleLabel.text = @"SemiLeftTableView"; 82 | semiLeft.tableViewRowHeight = 80.0f; 83 | self.leftSemiViewController = semiLeft; 84 | } 85 | 86 | - (void)showrightTableSemi:(id)sender 87 | { 88 | DXSubclassSemiTableViewController *semiRight = [[DXSubclassSemiTableViewController alloc] init]; 89 | semiRight.semiTitleLabel.text = @"SemiRightTableView"; 90 | self.rightSemiViewController = semiRight; 91 | } 92 | 93 | - (void)didReceiveMemoryWarning 94 | { 95 | [super didReceiveMemoryWarning]; 96 | // Dispose of any resources that can be recreated. 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXSemiSideDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | davidxie.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXSemiSideDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXSubClassSemiViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXSubClassSemiViewController.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DXSemiViewController.h" 12 | 13 | @interface DXSubClassSemiViewController : DXSemiViewController 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXSubClassSemiViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXSubClassSemiViewController.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXSubClassSemiViewController.h" 10 | 11 | @interface DXSubClassSemiViewController () 12 | 13 | @end 14 | 15 | @implementation DXSubClassSemiViewController 16 | 17 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 18 | { 19 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 20 | if (self) { 21 | } 22 | return self; 23 | } 24 | 25 | - (id)init 26 | { 27 | if (self = [super init]) { 28 | self.sideAnimationDuration = 0.6f; 29 | self.sideOffset = 100.0f; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)viewDidLoad 35 | { 36 | [super viewDidLoad]; 37 | self.contentView.alpha = 0.6f; 38 | self.contentView.backgroundColor = [UIColor greenColor]; 39 | } 40 | 41 | - (void)didReceiveMemoryWarning 42 | { 43 | [super didReceiveMemoryWarning]; 44 | // Dispose of any resources that can be recreated. 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXSubclassSemiTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DXSubclassSemiTableViewController.h 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-8. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DXSemiTableViewController.h" 11 | 12 | @interface DXSubclassSemiTableViewController : DXSemiTableViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /DXSemiSideDemo/DXSubclassSemiTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DXSubclassSemiTableViewController.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-8. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import "DXSubclassSemiTableViewController.h" 10 | 11 | @interface DXSubclassSemiTableViewController () 12 | 13 | @end 14 | 15 | @implementation DXSubclassSemiTableViewController 16 | 17 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 18 | { 19 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 20 | if (self) { 21 | // Custom initialization 22 | } 23 | return self; 24 | } 25 | 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | self.semiTableView.alpha = 0.6f; 31 | for (int i = 0; i < 100; i++) { 32 | [self.dateSourceArray addObject:[NSString stringWithFormat:@"SemiData%d", i]]; 33 | } 34 | } 35 | 36 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 37 | { 38 | return 1; 39 | } 40 | 41 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 42 | { 43 | return self.dateSourceArray.count; 44 | } 45 | 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 47 | { 48 | static NSString *identifier = @"cellId"; 49 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 50 | if (!cell) { 51 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 52 | } 53 | cell.textLabel.text = self.dateSourceArray[indexPath.row]; 54 | return cell; 55 | } 56 | 57 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 58 | { 59 | [self dismissSemi:nil]; 60 | } 61 | 62 | 63 | - (void)didReceiveMemoryWarning 64 | { 65 | [super didReceiveMemoryWarning]; 66 | // Dispose of any resources that can be recreated. 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /DXSemiSideDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "60x60", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "29x29", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "50x50", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "50x50", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "72x72", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "72x72", 41 | "scale" : "2x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /DXSemiSideDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /DXSemiSideDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /DXSemiSideDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DXSemiSideDemo 4 | // 5 | // Created by 谢 凯伟 on 13-7-7. 6 | // Copyright (c) 2013年 谢 凯伟. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "DXAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([DXAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiekw2010/DXSemiViewController/510768de55821b298fc9a0ccb3029528e34f1a16/Default-568h@2x.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DXSemiViewController 2 | ==================== 3 | 4 | Aside from the MainViewController's side beautifully 5 | 6 | Feature: 7 | 8 | 1. LightWeight & Simple 9 | 10 | 2. Support rotation autoresizing 11 | 12 | 13 | The API is simple: 14 | 15 | 1. import the DXSemiViewControllerCategory.h on your .m file 16 | 17 | 2. subclass the subclass the DXSemiViewController or the DXSemiTableViewController 18 | 19 | 3. On yourself viewController(anyViewController) ,And just use self.leftSemiViewController = someSemiSubClass. The subclass will animate from the left side. So does the self.rightSemiViewController = someSemiSubClass; 20 | 21 | 22 | PicDemo: 23 | 24 | ![screenshots](http://ww2.sinaimg.cn/bmiddle/84178573jw1e6fakxplsdg204g04gtg5.gif) 25 | 26 | ![screenshots](http://ww4.sinaimg.cn/bmiddle/84178573jw1e6falssrn5g204g04g7aj.gif) 27 | 28 | ![screenshots](http://ww2.sinaimg.cn/bmiddle/84178573jw1e6famnv5v8g204g04gn3x.gif) 29 | 30 | ![screenshots](http://ww2.sinaimg.cn/bmiddle/84178573jw1e6fanfdoo2g204g04gjxp.gif) 31 | 32 | 33 | --------------------------------------------------------------------------------