Skip to content

Commit

Permalink
UPDATE: Compatibility with older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicarq committed Apr 13, 2016
1 parent c4b645a commit 1cf1551
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 55 deletions.
7 changes: 6 additions & 1 deletion MBXPageController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = MBX;
LastUpgradeCheck = 0610;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = Moblox;
TargetAttributes = {
2E9DE2C51A47F04A0088A0A6 = {
Expand Down Expand Up @@ -335,6 +335,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -397,6 +398,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = MBXPageController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Moblox.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -407,6 +409,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = MBXPageController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Moblox.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand All @@ -425,6 +428,7 @@
);
INFOPLIST_FILE = MBXPageControllerTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Moblox.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MBXPageController.app/MBXPageController";
};
Expand All @@ -440,6 +444,7 @@
);
INFOPLIST_FILE = MBXPageControllerTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.Moblox.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MBXPageController.app/MBXPageController";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ - (void)viewDidLoad {
// Initiate MBXPageController
MBXPageViewController *MBXPageController = [MBXPageViewController new];
MBXPageController.MBXDataSource = self;
[MBXPageController reloadPagesToCurrentPageIndex:0];
[MBXPageController reloadPages];
}

#pragma mark - MBXPageViewController Data Source
Expand Down
2 changes: 1 addition & 1 deletion MBXPageController/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.Moblox.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
10 changes: 2 additions & 8 deletions MBXPageController/LeftRightArrows/MBXLeftRightViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ - (void)viewDidLoad {
self.MBXPageController.MBXDataSource = self;
self.MBXPageController.MBXDataDelegate = self;
self.MBXPageController.pageMode = MBX_LeftRightArrows;
[self.MBXPageController reloadPagesToCurrentPageIndex:0];
[self.MBXPageController reloadPages];
}

- (IBAction)goToThirdScreen:(id)sender {

[self.MBXPageController moveToViewNumber:2 animated:true];
}

Expand Down Expand Up @@ -78,15 +77,10 @@ - (NSArray *)MBXPageControllers

#pragma mark - MBXPageViewController Delegate

- (void)MBXPageChangedToIndex:(NSInteger)index
{
- (void)MBXPageChangedToIndex:(NSInteger)index {
NSInteger humanizeIndex = index + 1;
self.currentIndicator.text = [NSString stringWithFormat:@"%li", (long)humanizeIndex];
NSLog(@"%@ %ld", [self class], (long)index);
}

-(void)MBXPageChanged {
NSLog(@"teste");
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ typedef NS_ENUM(NSInteger, MBXPageMode) {

@property (nonatomic, assign) MBXPageMode pageMode; // This selects the mode of the PageViewController

- (void)reloadPagesToCurrentPageIndex:(NSInteger)currentPageIndex; // Like reloadData in tableView. You need to call this method to update the stack of viewcontrollers and/or buttons
- (void)reloadPages; // Like reloadData in tableView. You need to call this method to update the stack of viewcontrollers and/or buttons
- (void)reloadPagesToCurrentPageIndex:(NSInteger)currentPageIndex; // Like reloadData in tableView. You need to call this method to update the stack of viewcontrollers and/or buttons

- (void)moveToViewNumber:(NSInteger)viewNumber __attribute__((deprecated)); // Default to YES. Deprecated.
- (void)moveToViewNumber:(NSInteger)viewNumber animated:(BOOL)animated; // The ViewController position. Starts from 0
@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

#pragma mark - Public

- (void)reloadPages {
[self reloadPagesToCurrentPageIndex:0];
}

- (void)reloadPagesToCurrentPageIndex:(NSInteger)currentPageIndex {
// Initialize/ Refresh everything
self.currentPageIndex = currentPageIndex;
Expand All @@ -61,6 +65,10 @@ - (void)otherConfiguration {
// Replace me
}

- (void)moveToViewNumber:(NSInteger)viewNumber {
[self moveToViewNumber:viewNumber animated:YES];
}

- (void)moveToViewNumber:(NSInteger)viewNumber animated:(BOOL)animated {
NSAssert([_viewControllerArray count] > viewNumber, @"viewNumber exceeds the number of current viewcontrollers");
id viewController = _viewControllerArray[viewNumber];
Expand Down
Loading

0 comments on commit 1cf1551

Please sign in to comment.