Skip to content

Commit

Permalink
添加关于
Browse files Browse the repository at this point in the history
  • Loading branch information
fengchuanxiang committed Apr 13, 2016
1 parent d7dc5f1 commit 98434f7
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 2 deletions.
50 changes: 50 additions & 0 deletions FCXUniversial/FCXAbout/FCXAboutController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// FCXAboutController.h
// FCXUniversial
//
// Created by 冯 传祥 on 16/4/13.
// Copyright © 2016年 冯 传祥. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface FCXAboutController : UIViewController


/**
* 图片名(必须填写).
* 现在固定显示大小是130*130
*/
@property (nonatomic, copy) NSString *imageName;

/**
* 第一行显示的产品名(可不写).
* 默认取CFBundleDisplayName的名字.
*/
@property (nonatomic, copy) NSString *appName;

/**
* 中间显示的一段描述(必须填写).
*/
@property (nonatomic, copy) NSString *midString;

/**
* 是否显示下面三行.
* 默认不显示.
*/
@property (nonatomic, unsafe_unretained) BOOL showBottom;

/**
* 底部左边文案(可不写,注意换行分割).
* 默认是:@"产品:\n设计:\n工程师:",
*/
@property (nonatomic, copy) NSString *bottomLeftString;

/**
* 底部右边文案(如果显示下面三行则必须填写,注意换行分割).
* 根据情况填写,如:@"杨磊\n张丹丹\n冯传祥".
*/
@property (nonatomic, copy) NSString *bottomRightString;


@end
114 changes: 114 additions & 0 deletions FCXUniversial/FCXAbout/FCXAboutController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//
// FCXAboutController.m
// FCXUniversial
//
// Created by 冯 传祥 on 16/4/13.
// Copyright © 2016年 冯 传祥. All rights reserved.
//

#import "FCXAboutController.h"
#import "FCXDefine.h"

@interface FCXAboutController ()

@end

@implementation FCXAboutController

- (void)viewDidLoad {
[super viewDidLoad];

self.edgesForExtendedLayout = UIRectEdgeNone;
self.view.backgroundColor = UICOLOR_FROMRGB(0xf5f5f5);

CGFloat statusBarHeight = 20;
if ([UIApplication sharedApplication].statusBarHidden) {
statusBarHeight = 0;
}
CGFloat top = 78;
if (SCREEN_HEIGHT == 480) {
top = 20;
}else if (SCREEN_HEIGHT == 568) {
top = 40;
}

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 130)/2.0, top, 130, 130)];
imageView.image = [UIImage imageNamed:self.imageName];
[self.view addSubview:imageView];

NSString *str = [NSString stringWithFormat:@"%@\n%@", self.appName, self.midString];
NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:str];

[attributedStr addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"Helvetica-Bold" size:28]
range:NSMakeRange(0, self.appName.length)];

[attributedStr addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"HelveticaNeue-Light" size:16]
range:NSMakeRange(self.appName.length, str.length - self.appName.length)];

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 10;
paragraphStyle.alignment = NSTextAlignmentCenter;
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, str.length)];

CGFloat height = [attributedStr boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 20, 0) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size.height;

UILabel *midLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, imageView.frame.origin.y + imageView.frame.size.height + 10, SCREEN_WIDTH - 20, height)];
midLabel.backgroundColor = self.view.backgroundColor;
midLabel.textColor = UICOLOR_FROMRGB(0x343233);
midLabel.numberOfLines = 0;
midLabel.attributedText = attributedStr;
[self.view addSubview:midLabel];

UILabel *versionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, midLabel.frame.origin.y + midLabel.frame.size.height + 20, SCREEN_WIDTH, 15)];
versionLabel.textColor = midLabel.textColor;
versionLabel.textAlignment = NSTextAlignmentCenter;
versionLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:16];
versionLabel.text = [NSString stringWithFormat:@"V %@", APP_VERSION];
[self.view addSubview:versionLabel];

if (self.showBottom) {
attributedStr = [[NSMutableAttributedString alloc] initWithString:self.bottomLeftString];
paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 6;
paragraphStyle.alignment = NSTextAlignmentRight;
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, self.bottomLeftString.length)];

UILabel *bottomLeftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 180 - statusBarHeight, SCREEN_WIDTH/2.0, 140)];
bottomLeftLabel.textColor = UICOLOR_FROMRGB(0x343233);
bottomLeftLabel.textAlignment = NSTextAlignmentRight;
bottomLeftLabel.numberOfLines = 0;
bottomLeftLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17];
bottomLeftLabel.attributedText = attributedStr;
[self.view addSubview:bottomLeftLabel];

attributedStr = [[NSMutableAttributedString alloc] initWithString:self.bottomRightString];
paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 6;
paragraphStyle.alignment = NSTextAlignmentLeft;
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, self.bottomRightString.length)];
UILabel *bottomRightLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2.0, bottomLeftLabel.frame.origin.y, bottomLeftLabel.frame.size.width, bottomLeftLabel.frame.size.height)];
bottomRightLabel.textColor = UICOLOR_FROMRGB(0x343233);
bottomRightLabel.textAlignment = NSTextAlignmentLeft;
bottomRightLabel.numberOfLines = 0;
bottomRightLabel.font = bottomLeftLabel.font;
bottomRightLabel.attributedText = attributedStr;
[self.view addSubview:bottomRightLabel];
}
}

- (NSString *)appName {
if (!_appName) {
_appName = APP_DISPLAYNAME;
}
return _appName;
}
- (NSString *)bottomLeftString {
if (!_bottomLeftString) {
_bottomLeftString = @"产品:\n设计:\n工程师:";
}
return _bottomLeftString;
}

@end
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ NSString *placementId = @"4050412012239592";

###分享功能

目前支持通用的图文分享、音乐分享、图片分享和单个平台分享.
目前支持通用的图文分享(邀请好友)、音乐分享、图片分享和单个平台分享.

包含头文件
```objc
#import "FCXShareManager.h"
```
####图文分享
####图文分享(邀请好友)
```objc
FCXShareManager *shareManager = [FCXShareManager sharedManager];
shareManager.presentedController = self;
Expand Down Expand Up @@ -209,3 +209,21 @@ NSString *placementId = @"4050412012239592";
[shareManager shareToPlatform:FCXSharePlatformWXSession];
```


##关于
包含头文件:
```objc
#import "UIViewController+Advert.h"
```
设置数(详情可点击头文件查看注释):
```objc
@property (nonatomic, copy) NSString *imageName;
@property (nonatomic, copy) NSString *appName;
@property (nonatomic, copy) NSString *midString;
@property (nonatomic, unsafe_unretained) BOOL showBottom;
@property (nonatomic, copy) NSString *bottomLeftString;
@property (nonatomic, copy) NSString *bottomRightString;
```
界面样式:
![]([email protected])

Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 98434f7

Please sign in to comment.