Skip to content

Commit

Permalink
Replace strong reference to delegate inside RDVTabBar with weak refer…
Browse files Browse the repository at this point in the history
…ence, fix a bug with wrong sized view when starting in landscape orientation.
  • Loading branch information
robbdimitrov committed Jul 8, 2014
1 parent f010492 commit 489a3a5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Example/Classes/Controllers/RDVFirstViewController.m
Expand Up @@ -90,7 +90,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 15;
return 30;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2013 Robert Dimitrov
Copyright (c) 2013-2014 Robert Dimitrov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
Expand Down
4 changes: 2 additions & 2 deletions RDVTabBarController.podspec
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "RDVTabBarController"
s.version = "1.1.6"
s.version = "1.1.7"
s.summary = "Highly customizable tabBar and tabBarController for iOS"
s.description = "RDVTabBarController is iPad and iPhone compatible. Supports landscape and portrait orientations and can be used inside UINavigationController."
s.homepage = "https://github.com/robbdimitrov/RDVTabBarController"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Robert Dimitrov" => "robert_dimitrov@me.com" }
s.platform = :ios, '5.0'
s.source = { :git => "https://github.com/robbdimitrov/RDVTabBarController.git", :tag => "v1.1.6" }
s.source = { :git => "https://github.com/robbdimitrov/RDVTabBarController.git", :tag => "v1.1.7" }
s.source_files = 'RDVTabBarController', 'RDVTabBarController/**/*.{h,m}'
s.framework = 'UIKit', 'CoreGraphics', 'Foundation'
s.requires_arc = true
Expand Down
2 changes: 1 addition & 1 deletion RDVTabBarController/RDVTabBar.h
Expand Up @@ -44,7 +44,7 @@
/**
* The tab bar’s delegate object.
*/
@property id <RDVTabBarDelegate> delegate;
@property (nonatomic, weak) id <RDVTabBarDelegate> delegate;

/**
* The items displayed on the tab bar.
Expand Down
16 changes: 7 additions & 9 deletions RDVTabBarController/RDVTabBarController.m
Expand Up @@ -148,7 +148,8 @@ - (RDVTabBar *)tabBar {
_tabBar = [[RDVTabBar alloc] init];
[_tabBar setBackgroundColor:[UIColor clearColor]];
[_tabBar setAutoresizingMask:UIViewAutoresizingFlexibleWidth|
UIViewAutoresizingFlexibleTopMargin];
UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleLeftMargin|
UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin];
[_tabBar setDelegate:self];
}
return _tabBar;
Expand All @@ -159,7 +160,8 @@ - (UIView *)contentView {
_contentView = [[UIView alloc] init];
[_contentView setBackgroundColor:[UIColor whiteColor]];
[_contentView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|
UIViewAutoresizingFlexibleHeight];
UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleLeftMargin|
UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin];
}
return _contentView;
}
Expand All @@ -170,21 +172,17 @@ - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated {
__weak RDVTabBarController *weakSelf = self;

void (^block)() = ^{
CGSize viewSize = weakSelf.view.frame.size;
CGSize viewSize = weakSelf.view.bounds.size;
CGFloat tabBarStartingY = viewSize.height;
CGFloat contentViewHeight = viewSize.height;
CGFloat tabBarHeight = CGRectGetHeight([[weakSelf tabBar] frame]);

NSLog(@"viewSize = %@", NSStringFromCGSize(viewSize));

if (!tabBarHeight) {
tabBarHeight = 49;
}

if (![weakSelf parentViewController]) {
if (UIInterfaceOrientationIsLandscape([weakSelf interfaceOrientation])) {
viewSize = CGSizeMake(viewSize.height, viewSize.width);
}
}

if (!hidden) {
tabBarStartingY = viewSize.height - tabBarHeight;
if (![[weakSelf tabBar] isTranslucent]) {
Expand Down

0 comments on commit 489a3a5

Please sign in to comment.