Commit 8b02b87a cgx

更新舒眠课程和助眠音乐列表页面UI布局

1 个父辈 f329caab
......@@ -1933,7 +1933,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = SPH85C3TWU;
DEVELOPMENT_TEAM = 38Y8286C84;
EXCLUDED_ARCHS = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
......@@ -1960,6 +1960,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UIUserInterfaceStyle = UIUserInterfaceStyleLight;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
......@@ -2027,6 +2028,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UIUserInterfaceStyle = UIUserInterfaceStyleLight;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
......@@ -2156,6 +2158,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UIUserInterfaceStyle = UIUserInterfaceStyleLight;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
......
......@@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIUserInterfaceStyle</key>
<string>UIUserInterfaceStyleLight</string>
<key>Bundle_Display_Name</key>
<string>$(App_Display_Name)</string>
<key>CFBundleURLTypes</key>
......
......@@ -51,7 +51,7 @@
[btn dk_setTitleColorPicker:DKColorPickerWithColors(MainTextColor, ColorFromHex(0xE8E9E9), DSWhite) forState:UIControlStateNormal];
} else {
[btn.titleLabel setFont:SysFont(15)];
[btn dk_setTitleColorPicker:DKColorPickerWithColors(SubTitleColor, ColorFromHex(0x7A7F8E), DSWhite) forState:UIControlStateNormal];
[btn dk_setTitleColorPicker:DKColorPickerWithColors(ColorFromHexA(0x333333, .49), ColorFromHex(0x7A7F8E), DSWhite) forState:UIControlStateNormal];
}
}
}
......@@ -59,7 +59,7 @@
- (void)switchViewControllerAction:(UIButton *)sender {
_selectedIndex = sender.tag;
[UIView animateWithDuration:.3 animations:^{
self->_indicatorView.x = sender.x;
self->_indicatorView.centerX = sender.centerX;
[self->_bodyView setContentOffset:CGPointMake(sender.tag * self->_bodyView.width, 0)];
}];
[self adjustUI];
......@@ -93,7 +93,7 @@
_selectedIndex = index;
UIButton *btn = _btns[index];
[UIView animateWithDuration:.3 animations:^{
self->_indicatorView.x = btn.x;
self->_indicatorView.centerX = btn.centerX;
}];
[self adjustUI];
}
......@@ -103,12 +103,13 @@
if (!_headView) {
_headView = [[UIView alloc] initWithFrame:CGRectMake(15, 0, kScreenWidth - 30, 40)];
UIButton *btn1 = [self btnWithTitle:@"舒眠课程" font:BoldFont(16) tag:0 sView:_headView];
UIButton *btn2 = [self btnWithTitle:@"放松音乐" font:SysFont(15) tag:1 sView:_headView];
_indicatorView = [UIView new];
_indicatorView.backgroundColor = BrandColor;
[_headView addSubview:_indicatorView];
UIButton *btn1 = [self btnWithTitle:@"舒眠课程" font:BoldFont(16) tag:0 sView:_headView];
UIButton *btn2 = [self btnWithTitle:@"放松音乐" font:SysFont(15) tag:1 sView:_headView];
[btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_headView);
make.bottom.equalTo(_headView).offset(1);
......@@ -120,10 +121,10 @@
make.size.equalTo(btn1);
}];
[_indicatorView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(btn1);
make.width.equalTo(@64);
make.centerX.equalTo(_defaultIndex == 0 ? btn1 : btn2);
make.height.equalTo(@4);
make.bottom.equalTo(_headView);
make.bottom.equalTo(_headView).offset(-4);
}];
_btns = @[btn1, btn2];
......
......@@ -55,19 +55,16 @@
return self.listArr.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CourseCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CourseCollectionCellID" forIndexPath:indexPath];
CourseModel *model = [self.listArr objectAtIndex:indexPath.row];
if (indexPath.row < self.listArr.count) {
cell.model = model;
}
cell.courseType = _type;
return cell;
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(24, 15, 24, 15);
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
if (self.listArr.count > indexPath.row) {
CourseModel *model = [self.listArr objectAtIndex:indexPath.row];
......@@ -84,9 +81,9 @@
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.sectionFootersPinToVisibleBounds = YES;
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
CGFloat width = (kScreenWidth - 60)/3;
layout.itemSize = CGSizeMake(width, 130);
layout.minimumInteritemSpacing = 15;
layout.itemSize = [CourseModel itemSize];
layout.sectionInset = [CourseModel sectionEdgeInset];
layout.minimumLineSpacing = [CourseModel minimumLineSpacing];
_courseListView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, self.view.height - Bottom_SafeArea_Height - kTopHeight(0) - 40) collectionViewLayout:layout];
_courseListView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
_courseListView.showsVerticalScrollIndicator = NO;
......
......@@ -35,6 +35,15 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *home_img;
// 课程数量
@property (nonatomic, assign) int count;
#pragma mark - 用于计算cell大小
+ (CGFloat)cellWidth;
+ (CGFloat)cellHeight;
+ (CGFloat)leftRightMargin;
+ (CGFloat)midSpace;
+ (CGFloat)minimumLineSpacing;
+ (CGSize)itemSize;
+ (UIEdgeInsets)sectionEdgeInset;
@end
NS_ASSUME_NONNULL_END
......@@ -13,4 +13,48 @@
return @{@"course_id" : @"id"};
}
+ (CGFloat)cellWidth {
CGFloat width = 166;
if (iPhone5) {
width = 80;
}
return width;
}
+ (CGFloat)cellHeight {
return [self cellWidth] + 30;
}
+ (CGFloat)leftRightMargin {
return 15;
}
+ (CGFloat)midSpace {
return 0;
}
+ (CGFloat)minimumLineSpacing {
return 24;
}
+ (CGFloat)sectionTop {
return 24;
}
+ (int)itemCount {
CGFloat itemCount = 2;
if (iPhone5) {
itemCount = 3;
}
return itemCount;
}
+ (CGSize)itemSize {
return CGSizeMake([self cellWidth], [self cellHeight]);
}
+ (UIEdgeInsets)sectionEdgeInset {
return UIEdgeInsetsMake([self sectionTop], [self leftRightMargin], [self sectionTop], [self leftRightMargin]);
}
@end
......@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 舒眠课程和助眠音乐课程列表Cell
@interface CourseCollectionCell : UICollectionViewCell
@property (nonatomic, strong) CourseModel *model;
@property (nonatomic, assign) CourseType courseType;
@end
NS_ASSUME_NONNULL_END
......@@ -18,20 +18,20 @@
if (self = [super initWithFrame:frame]) {
_templeImgView = [UIImageView new];
_templeImgView.dk_alphaPicker = DKAlphaPickerWithAlphas(1.0, .5, .5);
[_templeImgView cornerRadius:10.0];
[self.contentView addSubview:_templeImgView];
_templeNameLb = [UILabel new];
_templeNameLb.textAlignment = NSTextAlignmentLeft;
_templeNameLb.font = SysFont(14);
_templeNameLb.font = SysFont(15);
_templeNameLb.textAlignment = 0;
_templeNameLb.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, ColorFromHex(0x7E8392), DSWhite);
_templeNameLb.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, ColorFromHex(0x7E8392), DSWhite);
[self.contentView addSubview:_templeNameLb];
[_templeImgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView.mas_top).offset(5);
make.centerX.equalTo(self.contentView.mas_centerX);
make.height.equalTo(@90);
make.width.equalTo(@90);
make.left.equalTo(self.contentView);
make.width.height.equalTo(@([CourseModel cellWidth]));
}];
[_templeNameLb mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.templeImgView.mas_left);
......@@ -48,4 +48,5 @@
[self.templeImgView yy_setImageWithURL:[NSURL URLWithString:model.audio_img] placeholder:[UIImage imageNamed:@"basicPlaceholder"]];
self.templeNameLb.text = model.audio_name;
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UnityLaunchScreen-ViewController">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UnityLaunchScreen-ViewController">
<device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment version="4352" identifier="iOS"/>
<development version="9000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
......@@ -39,6 +38,6 @@
</scene>
</scenes>
<resources>
<image name="LaunchScreen-iPhonePortrait.png" width="1242" height="2208"/>
<image name="LaunchScreen-iPhonePortrait.png" width="1" height="1"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
LastUpgradeVersion = "1330"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!