- Fix Test Project

This commit is contained in:
giuseppenuc committed 2015-07-17 10:49:59 +02:00
1 parent 6fe5a9839c
commit c2be9705ac
33 files changed
+1913 -1208

No files matched your search

+15
View File
@@ -9,6 +9,12 @@
#import "TabBarItem.h"
#import <PureLayout/PureLayout.h>
@interface TabBarItem()
@property (nonatomic) UIDeviceOrientation orientation;
@end
@implementation TabBarItem
- (instancetype) initWithSubItems:(NSArray*) array {
@@ -16,6 +22,8 @@
if (self) {
NSAssert(array, @"SubItemsArray cannot be nil");
_orientation = [[UIDevice currentDevice] orientation];
[[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(deviceOrientationDidChange:) name: UIDeviceOrientationDidChangeNotification object: nil];
_subItems = [[NSMutableArray alloc] init];
@@ -28,4 +36,11 @@
return self;
}
- (void)deviceOrientationDidChange:(NSNotification *)notification {
//Obtain current device orientation
_orientation = [[UIDevice currentDevice] orientation];
}
@end
-2
View File
@@ -25,8 +25,6 @@ typedef enum
@property (nonatomic, readonly) CGSize tabBarSize;
@property (nonatomic) TabBarPickerPosition position;
+ (NSString*) tabBarVersion;
/**
* Init TabBarPicker with items. When is selected an item the picher show down subitems.
* By default when one of more subItems are selected the selected item become selected.
+30 -19
View File
@@ -12,22 +12,16 @@
#define tabBarSizeVertical CGSizeMake()
@interface TabBarPicker(){
}
@interface TabBarPicker()
@property (nonatomic) UIDeviceOrientation orientation;
@end
@implementation TabBarPicker
+ (NSString*) tabBarVersion {
return @"1";
}
- (instancetype) initWithTabBarItems:(NSArray *)items forPosition:(TabBarPickerPosition)position {
NSLog(@"init");
return [self initWithTabBarItems:items withTabBarSize:CGSizeZero forPosition:position];
}
@@ -36,11 +30,15 @@
self = [self initForAutoLayout];
if (self) {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(deviceOrientationDidChange:) name: UIDeviceOrientationDidChangeNotification object: nil];
NSAssert(items, @"TabBar Items array cannot be nil!");
if (CGSizeEqualToSize(size, CGSizeZero)) {
_tabBarSize = CGSizeMake([[UIScreen mainScreen] bounds].size.width, 100);
_tabBarSize = CGSizeMake([[UIScreen mainScreen] bounds].size.width, 44);
}
_tabBarItems = [[NSMutableArray alloc] init];
@@ -51,21 +49,34 @@
}
}
}
NSLog(@"prova");
[self autoSetDimension:ALDimensionWidth toSize:[[UIScreen mainScreen] bounds].size.width relation:NSLayoutRelationLessThanOrEqual];
[self autoSetDimension:ALDimensionHeight toSize:_tabBarSize.height relation:NSLayoutRelationLessThanOrEqual];
for (TabBarItem *item in _tabBarItems) {
}
return self;
}
- (void) layoutSubviews {
[self autoSetDimension:ALDimensionHeight toSize:44];
[self autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:self.superview];
[self autoPinEdgeToSuperviewMargin:ALEdgeBottom];
for (TabBarItem *item in _tabBarItems) {
}
}
- (void)deviceOrientationDidChange:(NSNotification *)notification {
//Obtain current device orientation
_orientation = [[UIDevice currentDevice] orientation];
[self layoutSubviews];
}
- (void) layoutSubviewsPortrait {
}
- (void) layoutSubviewsLandScape {
}
+17
View File
@@ -9,6 +9,12 @@
#import "TabBarSubItem.h"
#import <PureLayout/PureLayout.h>
@interface TabBarSubItem()
@property (nonatomic) UIDeviceOrientation orientation;
@end
@implementation TabBarSubItem
@@ -16,6 +22,9 @@
self = [self initForAutoLayout];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(deviceOrientationDidChange:) name: UIDeviceOrientationDidChangeNotification object: nil];
_name = name;
}
return self;
@@ -25,4 +34,12 @@
return [[self alloc] initWithName:name];
}
- (void)deviceOrientationDidChange:(NSNotification *)notification {
//Obtain current device orientation
_orientation = [[UIDevice currentDevice] orientation];
}
@end