Commit 2ed793fa authored by Zhen Tan's avatar Zhen Tan Committed by GitHub

Merge pull request #321 from devSC/master

Adapt method for Swift and fix frame bugs when navigaiton bar translucent is NO.
parents 115f4046 683d5e56
......@@ -16,7 +16,7 @@
@property (nonatomic, strong) PHCachingImageManager *cachingImageManager;
+ (instancetype)manager;
+ (instancetype)manager NS_SWIFT_NAME(default());
@property (nonatomic, assign) BOOL shouldFixOrientation;
......
......@@ -516,8 +516,20 @@
albumModel.selectedModels = imagePickerVc.selectedModels;
}
if (!_tableView) {
CGFloat top = 44;
CGFloat top = 0;
CGFloat tableViewHeight = 0;
if (self.navigationController.navigationBar.isTranslucent) {
top = 44;
if (iOS7Later) top += 20;
tableViewHeight = self.view.tz_height - top;
}
else {
CGFloat navigationHeight = 44;
if (iOS7Later) navigationHeight += 20;
tableViewHeight = self.view.tz_height - navigationHeight;
}
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, top, self.view.tz_width, self.view.tz_height - top) style:UITableViewStylePlain];
_tableView.rowHeight = 70;
_tableView.tableFooterView = [[UIView alloc] init];
......
......@@ -119,9 +119,20 @@ static CGSize AssetGridThumbnailSize;
layout.itemSize = CGSizeMake(itemWH, itemWH);
layout.minimumInteritemSpacing = margin;
layout.minimumLineSpacing = margin;
CGFloat top = 44;
CGFloat top = 0;
CGFloat collectionViewHeight = 0;
if (self.navigationController.navigationBar.isTranslucent) {
top = 44;
if (iOS7Later) top += 20;
CGFloat collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - 50 - top : self.view.tz_height - top;
collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - 50 - top : self.view.tz_height - top;;
}
else {
CGFloat navigationHeight = 44;
if (iOS7Later) navigationHeight += 20;
collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - 50 - navigationHeight : self.view.tz_height - navigationHeight;
}
_collectionView = [[TZCollectionView alloc] initWithFrame:CGRectMake(0, top, self.view.tz_width, collectionViewHeight) collectionViewLayout:layout];
_collectionView.backgroundColor = [UIColor whiteColor];
_collectionView.dataSource = self;
......@@ -162,7 +173,17 @@ static CGSize AssetGridThumbnailSize;
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (!tzImagePickerVc.showSelectBtn) return;
UIView *bottomToolBar = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.tz_height - 50, self.view.tz_width, 50)];
CGFloat yOffset = 0;
if (self.navigationController.navigationBar.isTranslucent) {
yOffset = self.view.tz_height - 50;
}
else {
CGFloat navigationHeight = 44;
if (iOS7Later) navigationHeight += 20;
yOffset = self.view.tz_height - 50 - navigationHeight;
}
UIView *bottomToolBar = [[UIView alloc] initWithFrame:CGRectMake(0, yOffset, self.view.tz_width, 50)];
CGFloat rgb = 253 / 255.0;
bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
......
......@@ -217,6 +217,7 @@
// imagePickerVc.navigationBar.barTintColor = [UIColor greenColor];
// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
// imagePickerVc.navigationBar.translucent = NO;
// 3. Set allow picking video & photo & originalPhoto or not
// 3. 设置是否可以选择视频/图片/原图
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment