Commit 66309bf1 authored by Sandy's avatar Sandy

我的团队界面搭建

parent 41a8146f
This diff is collapsed.
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "team_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "team_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<connections> <connections>
<outlet property="imgView" destination="D99-gm-QhP" id="33R-h5-L3T"/> <outlet property="imgView" destination="D99-gm-QhP" id="33R-h5-L3T"/>
</connections> </connections>
<point key="canvasLocation" x="156.5" y="357.5"/> <point key="canvasLocation" x="289.5" y="426.5"/>
</collectionViewCell> </collectionViewCell>
</objects> </objects>
<resources> <resources>
......
//
// MyTeamCollectionViewCell.h
// ALand
//
// Created by Z on 16/4/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyTeamCollectionViewCell : UICollectionViewCell
- (void)cellWithModel:(id)model;
@end
//
// MyTeamCollectionViewCell.m
// ALand
//
// Created by Z on 16/4/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import "MyTeamCollectionViewCell.h"
#import "MBLabelWithFontAdapter.h"
@interface MyTeamCollectionViewCell ()
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelTeamNums;
@property (weak, nonatomic) IBOutlet UIImageView *imgViewTeam;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelPhone;
@property (weak, nonatomic) IBOutlet UILabel *labelAmount;
@property (weak, nonatomic) IBOutlet UIView *viewAmountBackround;
@end
@implementation MyTeamCollectionViewCell
- (void)awakeFromNib {
self.viewAmountBackround.layer.cornerRadius = self.viewAmountBackround.height / 2;
// Initialization code
}
- (void)cellWithModel:(id)model
{
self.labelTeamNums.text = [NSString stringWithFormat:@"一级成员(%d)", 2];
self.labelAmount.text = [NSString stringWithFormat:@"¥%0.2f",12.34];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="MyTeamCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="168" height="202"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="168" height="202"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="一级成员(3)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9UQ-ZX-IV8" customClass="MBLabelWithFontAdapter">
<rect key="frame" x="0.0" y="16" width="168" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="heightClass=compact-widthClass=compact">
<fontDescription key="fontDescription" type="system" pointSize="6"/>
</variation>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="749" image="team_icon" translatesAutoresizingMaskIntoConstraints="NO" id="Vil-wZ-5TN">
<rect key="frame" x="37" y="48" width="94" height="77"/>
<constraints>
<constraint firstAttribute="height" constant="90" id="ag5-Ds-Xru"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="ag5-Ds-Xru"/>
</mask>
</variation>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="18253423423" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dAd-yS-LSa" customClass="MBLabelWithFontAdapter">
<rect key="frame" x="0.0" y="145" width="168" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="KGQ-Df-U2B"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="KGQ-Df-U2B"/>
</mask>
</variation>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qvP-Dh-9Iw">
<rect key="frame" x="44" y="170" width="80" height="22"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="¥12.99" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QVd-gK-ILm">
<rect key="frame" x="10" y="0.0" width="60" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="QVd-gK-ILm" firstAttribute="height" secondItem="qvP-Dh-9Iw" secondAttribute="height" id="44u-8P-tgz"/>
<constraint firstAttribute="trailing" secondItem="QVd-gK-ILm" secondAttribute="trailing" constant="10" id="Lex-6U-lGJ"/>
<constraint firstItem="QVd-gK-ILm" firstAttribute="centerY" secondItem="qvP-Dh-9Iw" secondAttribute="centerY" id="TWf-wO-eaD"/>
<constraint firstAttribute="height" constant="22" id="ihq-gL-LGb"/>
<constraint firstItem="QVd-gK-ILm" firstAttribute="leading" secondItem="qvP-Dh-9Iw" secondAttribute="leading" constant="10" id="jcp-U8-GWX"/>
<constraint firstItem="QVd-gK-ILm" firstAttribute="centerX" secondItem="qvP-Dh-9Iw" secondAttribute="centerX" id="pSa-gz-eTj"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="qvP-Dh-9Iw" firstAttribute="top" secondItem="dAd-yS-LSa" secondAttribute="bottom" constant="5" id="5z2-Rk-xGs"/>
<constraint firstAttribute="trailing" secondItem="dAd-yS-LSa" secondAttribute="trailing" id="6OH-F9-UuD"/>
<constraint firstItem="Vil-wZ-5TN" firstAttribute="top" secondItem="9UQ-ZX-IV8" secondAttribute="bottom" constant="10" id="9IE-NA-PdK"/>
<constraint firstItem="9UQ-ZX-IV8" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="CDy-0B-L5T"/>
<constraint firstItem="9UQ-ZX-IV8" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="DQh-zj-Ftt"/>
<constraint firstAttribute="trailing" secondItem="9UQ-ZX-IV8" secondAttribute="trailing" id="QRa-Bc-d9w"/>
<constraint firstItem="dAd-yS-LSa" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="eGV-fi-VMP"/>
<constraint firstItem="dAd-yS-LSa" firstAttribute="top" secondItem="Vil-wZ-5TN" secondAttribute="bottom" constant="10" id="fF1-pf-H1I"/>
<constraint firstItem="Vil-wZ-5TN" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="hrh-N3-yQ5"/>
<constraint firstItem="qvP-Dh-9Iw" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="inO-P9-3ET"/>
<constraint firstItem="dAd-yS-LSa" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="jJ4-Nh-VLs"/>
<constraint firstAttribute="bottom" secondItem="qvP-Dh-9Iw" secondAttribute="bottom" constant="10" id="uoA-LK-Pp1"/>
<constraint firstItem="9UQ-ZX-IV8" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="16" id="vXA-Uo-Z7y"/>
<constraint firstItem="dAd-yS-LSa" firstAttribute="top" secondItem="Vil-wZ-5TN" secondAttribute="bottom" constant="20" id="xEe-Sr-XXa"/>
</constraints>
<size key="customSize" width="168" height="202"/>
<variation key="default">
<mask key="constraints">
<exclude reference="fF1-pf-H1I"/>
</mask>
</variation>
<connections>
<outlet property="imgViewTeam" destination="Vil-wZ-5TN" id="GQ4-jg-I7d"/>
<outlet property="labelAmount" destination="QVd-gK-ILm" id="qZg-fq-IAH"/>
<outlet property="labelPhone" destination="dAd-yS-LSa" id="ZUo-kt-QfD"/>
<outlet property="labelTeamNums" destination="9UQ-ZX-IV8" id="y5y-qh-ZHr"/>
<outlet property="viewAmountBackround" destination="qvP-Dh-9Iw" id="GxS-BJ-U1V"/>
</connections>
<point key="canvasLocation" x="266" y="286"/>
</collectionViewCell>
</objects>
<resources>
<image name="team_icon" width="94" height="94"/>
</resources>
</document>
This diff is collapsed.
//
// MyteamTopView.h
// ALand
//
// Created by Z on 16/4/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyteamTopView : UIView
- (void)setTeamNums:(NSInteger)nums bonus:(CGFloat)bonus;
@end
//
// MyteamTopView.m
// ALand
//
// Created by Z on 16/4/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import "MyteamTopView.h"
@interface MyteamTopView ()
@property (weak, nonatomic) IBOutlet UILabel *labelTeamNums;
@property (weak, nonatomic) IBOutlet UILabel *labelTeamBonus;
@end
@implementation MyteamTopView
- (void)setTeamNums:(NSInteger)nums bonus:(CGFloat)bonus
{
self.labelTeamNums.text = [NSString stringWithFormat:@"%lu", nums];
self.labelTeamBonus.text = [NSString stringWithFormat:@"¥%0.2f", bonus];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
...@@ -179,8 +179,8 @@ ...@@ -179,8 +179,8 @@
<variation key="default"> <variation key="default">
<mask key="constraints"> <mask key="constraints">
<exclude reference="JUD-tf-a0Z"/> <exclude reference="JUD-tf-a0Z"/>
<exclude reference="dAK-lK-vhu"/>
<exclude reference="Nkd-3W-crO"/> <exclude reference="Nkd-3W-crO"/>
<exclude reference="dAK-lK-vhu"/>
<exclude reference="BGr-IB-EEs"/> <exclude reference="BGr-IB-EEs"/>
</mask> </mask>
</variation> </variation>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#import "CommodityManagementViewController.h" #import "CommodityManagementViewController.h"
#import "OrderViewController.h" #import "OrderViewController.h"
#import "StoreManagermentViewController.h" #import "StoreManagermentViewController.h"
#import "MyTeamViewController.h"
#define kHomeCollectionViewID @"HomeCollectionViewID" #define kHomeCollectionViewID @"HomeCollectionViewID"
#define kCollectionViewHeadHeight 350 #define kCollectionViewHeadHeight 350
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
} }
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.row) { switch (indexPath.row) {
case 0://商品管理 case 0://商品管理
{ {
...@@ -138,19 +139,21 @@ ...@@ -138,19 +139,21 @@
} }
break; break;
case 2://分销管理 case 2://客户管理
{ {
} }
break; break;
case 3://客户管理 case 3://我的团队
{ {
MyTeamViewController *myTeamVC = [[MyTeamViewController alloc] init];
myTeamVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:myTeamVC animated:YES];
} }
break; break;
case 4://店铺管理 case 4://店铺设置
{ {
StoreManagermentViewController *storeVC = [[StoreManagermentViewController alloc] initWithNibName:@"StoreManagermentViewController" bundle:[NSBundle mainBundle]]; StoreManagermentViewController *storeVC = [[StoreManagermentViewController alloc] initWithNibName:@"StoreManagermentViewController" bundle:[NSBundle mainBundle]];
storeVC.hidesBottomBarWhenPushed = YES; storeVC.hidesBottomBarWhenPushed = YES;
...@@ -166,13 +169,13 @@ ...@@ -166,13 +169,13 @@
} }
break; break;
case 6://aland商城 case 6://课堂
{ {
} }
break; break;
case 7: case 7://榜
{ {
} }
......
//
// MyTeamViewController.h
// ALand
//
// Created by Z on 16/4/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface MyTeamViewController : IBTUIViewController
@end
//
// MyTeamViewController.m
// ALand
//
// Created by Z on 16/4/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import "MyTeamViewController.h"
#import "MyTeamCollectionViewCell.h"
#import "MyteamTopView.h"
#define kItemId @"MyTeamCollectionViewCell.h"
@interface MyTeamViewController ()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collectionView;
@end
@implementation MyTeamViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"我的团队";
[self setUpCollectionView];
// Do any additional setup after loading the view.
}
- (void)setUpCollectionView {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumInteritemSpacing = 0;
layout.minimumLineSpacing = 1;
layout.itemSize = CGSizeMake(kWidth / 3, kWidth * 2 / 3);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight - 64 - 49) collectionViewLayout:layout];
self.collectionView.contentInset = UIEdgeInsetsMake(140, 0, 0, 0);
self.collectionView.backgroundColor = kBacroundColor;
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
[self.collectionView registerNib:[UINib nibWithNibName:@"MyTeamCollectionViewCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:kItemId];
[self.view addSubview:self.collectionView];
[self setUpTopView];
}
- (void)setUpTopView {
MyteamTopView *topView = [MyteamTopView viewWithNibName:@"MyTeamTopView"];
topView.frame = CGRectMake(0, -140 + 20, kWidth, 100);
[self.collectionView addSubview:topView];
}
#pragma mark =========== collection delegate ===========
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return 10;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
MyTeamCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kItemId forIndexPath:indexPath];
return cell;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
orderDetailVC.orderType = ORDERTOPTYPE_CANCELED; orderDetailVC.orderType = ORDERTOPTYPE_CANCELED;
} }
orderDetailVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:orderDetailVC animated:YES]; [self.navigationController pushViewController:orderDetailVC animated:YES];
} }
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; baseVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[weakSelf presentViewController:baseVC animated:YES completion:nil]; [weakSelf presentViewController:baseVC animated:YES completion:nil];
} failure:^(NSURLSessionDataTask *task, NSError *error) { } failure:^(NSURLSessionDataTask *task, NSError *error) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
}]; }];
......
//
// JJBaseButton.h
// JinJiangDuCheng
//
// Created by Perry on 15/4/8.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MBFontAdapter.h"
@interface MBButtonWithFontAdapter : UIButton
@end
//
// JJBaseButton.m
// JinJiangDuCheng
//
// Created by Perry on 15/4/8.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import "MBButtonWithFontAdapter.h"
@implementation MBButtonWithFontAdapter
-(void)awakeFromNib{
[super awakeFromNib];
[self.titleLabel setFont:[MBFontAdapter adjustFont:self.titleLabel.font]];
}
@end
//
// JJLabel.h
// JinJiangDuCheng
//
// Created by Perry on 15/3/23.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MBFontAdapter.h"
@interface MBLabelWithFontAdapter : UILabel
@end
//
// JJLabel.m
// JinJiangDuCheng
//
// Created by Perry on 15/3/23.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import "MBLabelWithFontAdapter.h"
@implementation MBLabelWithFontAdapter
-(id)initWithCoder:(NSCoder *)aDecoder{
self = [super initWithCoder:aDecoder];
if (self){
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
-(void)awakeFromNib{
[super awakeFromNib];
[super setFont:[MBFontAdapter adjustFont:self.font]];
}
-(void)setFont:(UIFont *)font{
[super setFont:[MBFontAdapter adjustFont:font]];
}
@end
//
// JJBaseTextField.h
// JinJiangDuCheng
//
// Created by Perry on 15/4/8.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MBFontAdapter.h"
@interface MBTextFieldWithFontAdapter : UITextField
@end
//
// JJBaseTextField.m
// JinJiangDuCheng
//
// Created by Perry on 15/4/8.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import "MBTextFieldWithFontAdapter.h"
@implementation MBTextFieldWithFontAdapter
-(void)awakeFromNib{
[super awakeFromNib];
[super setFont:[MBFontAdapter adjustFont:self.font]];
}
-(void)setFont:(UIFont *)font{
[super setFont:[MBFontAdapter adjustFont:font]];
}
@end
//
// MBTextViewWithFontAdapter.h
// MBFontAdapter
//
// Created by Perry on 15/6/15.
// Copyright (c) 2015年 MmoaaY. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "MBFontAdapter.h"
@interface MBTextViewWithFontAdapter : UITextView
@end
//
// MBTextViewWithFontAdapter.m
// MBFontAdapter
//
// Created by Perry on 15/6/15.
// Copyright (c) 2015年 MmoaaY. All rights reserved.
//
#import "MBTextViewWithFontAdapter.h"
@implementation MBTextViewWithFontAdapter
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
-(void)awakeFromNib{
[super awakeFromNib];
[super setFont:[MBFontAdapter adjustFont:self.font]];
}
-(void)setFont:(UIFont *)font{
[super setFont:[MBFontAdapter adjustFont:font]];
}
@end
//
// MBFontAdapter.h
// JinJiangDuCheng
//
// 首先,为什么会有MBFontAdapter这么奇葩的一个库?原因很简单,当某天UI萌妹子弱弱地问你:“我们的app可不可以实现
// 文字的字号在iPhone6上和iPhone6Plus上比iPhone4s和iPhone5大一些?如果要实现难度是不是比较大?工作量会不会增加很
// 多?”乍一听还真有点头大。然而,这个时候你能回答不可以么?能回答很难么?能回答工作量会增加很多么?显然不能!!!于是
// MBFontAdapter就诞生了。功能很简单。因为常用的有文字的控件就那么几个:UIButton,UILabel,UITextField,UITextView。
// 所以程序猿MmoaaY采用了非常猥琐的方式来满足UI萌妹子的私欲。如果有类似经历的程序猿,这个库或许能给你提供一些灵感和帮助。
// 当然,也许这并没有什么卵用(因为貌似大部分app都不这么干……)
//
// tips:目前完美支持storyboard及xib。只需要将控件的Class选项设置为相应的类名即可。
// 如:UILabel的Class设置为:MBLabelWithFontAdapter
//
// Created by Perry on 15/4/8.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#define IS_IPHONE_6 ([[UIScreen mainScreen] bounds].size.height == 667.0f)
#define IS_IPHONE_6_PLUS ([[UIScreen mainScreen] bounds].size.height == 736.0f)
// 这里设置iPhone6放大的字号数(现在是放大2号,也就是iPhone4s和iPhone5上字体为15时,iPhone6上字号为17)
#define IPHONE6_INCREMENT 2
// 这里设置iPhone6Plus放大的字号数(现在是放大3号,也就是iPhone4s和iPhone5上字体为15时,iPhone6上字号为18)
#define IPHONE6PLUS_INCREMENT 3
@interface MBFontAdapter : NSObject
+(UIFont *)adjustFont:(UIFont *)font;
@end
//
// MBFontAdapter.m
// JinJiangDuCheng
//
// Created by Perry on 15/4/8.
// Copyright (c) 2015年 SmartJ. All rights reserved.
//
#import "MBFontAdapter.h"
@implementation MBFontAdapter
+(UIFont *)adjustFont:(UIFont *)font{
UIFont *newFont=nil;
if (IS_IPHONE_6){
newFont = [UIFont fontWithName:font.fontName size:font.pointSize+IPHONE6_INCREMENT];
}else if (IS_IPHONE_6_PLUS){
newFont = [UIFont fontWithName:font.fontName size:font.pointSize+IPHONE6PLUS_INCREMENT];
}else{
newFont = font;
}
return newFont;
}
@end
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