Commit f72440f4 authored by zhu's avatar zhu

Merge branch 'master' of https://git.oschina.net/gomore/Opple-iOS

Conflicts:
	Lighting/Lighting.xcodeproj/project.pbxproj
parents 9d98eb68 5437c3e6
...@@ -10,4 +10,47 @@ ...@@ -10,4 +10,47 @@
@interface ClientViewController : BaseViewController @interface ClientViewController : BaseViewController
/**
* tableview
*/
@property (weak, nonatomic) IBOutlet UITableView *informationTableview;
/**
* 客户名称
*/
@property (weak, nonatomic) IBOutlet UITextField *customerNameField;
/**
* 手机号码
*/
@property (weak, nonatomic) IBOutlet UITextField *phoneNumberField;
/**
* 公司名称
*/
@property (weak, nonatomic) IBOutlet UITextField *companyNameField;
/**
* 客户地址
*/
@property (weak, nonatomic) IBOutlet UITextField *customerAddress;
/**
* 添加客户信息
*/
@property (weak, nonatomic) IBOutlet UIButton *addpersonInformationButton;
/**
* 更改客户信息
*/
@property (weak, nonatomic) IBOutlet UIButton *changePersonInformationButton;
/**
* 搜索客户信息
*/
@property (weak, nonatomic) IBOutlet UITextField *searchPersonInformationField;
@end @end
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
// //
#import "ClientViewController.h" #import "ClientViewController.h"
#import "InformationTableViewCell.h"
@interface ClientViewController () @interface ClientViewController ()<UITableViewDelegate,UITableViewDataSource>
@end @end
...@@ -18,22 +18,39 @@ ...@@ -18,22 +18,39 @@
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
[self uiConfigAction];
}
#pragma mark -布局
- (void)uiConfigAction
{
self.informationTableview.delegate = self;
self.informationTableview.dataSource = self;
self.informationTableview.tableFooterView = [UIView new];
}
// UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
// button.frame = CGRectMake(100, 100, 100, 100); {
// button.backgroundColor = [UIColor blackColor]; InformationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"information" forIndexPath:indexPath];
// [self.view addSubview:button];
// [button addTarget:self action:@selector(Click) forControlEvents:UIControlEventTouchUpInside]; return cell;
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 20;
}
- (void)Click - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
RightViewController *right = [[RightViewController alloc]init]; return 100;
[self.navigationController pushViewController:right animated:YES];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
//
// CustomerdetailsController.h
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface CustomerdetailsController : BaseViewController
@end
//
// CustomerdetailsController.m
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "CustomerdetailsController.h"
@interface CustomerdetailsController ()
@end
@implementation CustomerdetailsController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (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
//
// InformationTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface InformationTableViewCell : UITableViewCell
@end
//
// InformationTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "InformationTableViewCell.h"
@implementation InformationTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#import "LoginViewController.h" #import "LoginViewController.h"
#import "CustomTabbarController.h" #import "CustomTabbarController.h"
#import "AppDelegate.h" #import "AppDelegate.h"
#import "MMDrawerVisualState.h"
#import "MMExampleDrawerVisualStateManager.h"
@interface LoginViewController () @interface LoginViewController ()
@property (weak, nonatomic) IBOutlet UIButton *loginButton; @property (weak, nonatomic) IBOutlet UIButton *loginButton;
...@@ -27,16 +29,32 @@ ...@@ -27,16 +29,32 @@
#pragma mark -登陆 #pragma mark -登陆
- (IBAction)LoginButtonClick:(UIButton *)sender { - (IBAction)LoginButtonClick:(UIButton *)sender {
[self MMDrawerController];
}
#pragma mark -MMDrawerController
- (void)MMDrawerController
{
CustomTabbarController *customtabbar = [[CustomTabbarController alloc]init]; CustomTabbarController *customtabbar = [[CustomTabbarController alloc]init];
RightViewController *rightVC = [[RightViewController alloc]init]; RightViewController *rightVC = [[RightViewController alloc]init];
self.drawerController = [[MMDrawerController alloc]initWithCenterViewController:customtabbar rightDrawerViewController:rightVC]; self.drawerController = [[MMDrawerController alloc]initWithCenterViewController:customtabbar rightDrawerViewController:rightVC];
[self.drawerController setMaximumRightDrawerWidth:RightWidth]; [self.drawerController setMaximumRightDrawerWidth:RightWidth];
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; [self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; [self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
[self.drawerController setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = [[MMExampleDrawerVisualStateManager sharedManager]
drawerVisualStateBlockForDrawerSide:drawerSide];
if(block){
block(drawerController, drawerSide, percentVisible);
}
}];
[[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:MMDrawerAnimationTypeSwingingDoor];
SHARED_APPDELEGATE.mmdrawer = self.drawerController;
SHARED_APPDELEGATE.window.rootViewController = self.drawerController; SHARED_APPDELEGATE.window.rootViewController = self.drawerController;
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -8,20 +8,79 @@ ...@@ -8,20 +8,79 @@
#import "RightViewController.h" #import "RightViewController.h"
@interface RightViewController () @interface RightViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong) UITableView *rightTableview;
@property (nonatomic,strong) NSArray *dataArray;
@end @end
@implementation RightViewController @implementation RightViewController
/**
* 初始化数据源
*
* @return NSArray
*/
- (NSArray *)dataArray
{
if (_dataArray == nil) {
_dataArray = [NSArray arrayWithObjects:@"随心配",@"体验中心",@"产品库",@"客户管理",@"关于", nil];
}
return _dataArray;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor blueColor];
[self uiConfigAction];
}
#pragma mark -布局
- (void)uiConfigAction
{
self.rightTableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, RightWidth, ScreenHeight) style:UITableViewStylePlain];
self.rightTableview.delegate = self;
self.rightTableview.dataSource = self;
[self.view addSubview:self.rightTableview];
self.rightTableview.tableFooterView = [UIView new];
[self.rightTableview registerClass:[UITableViewCell class] forCellReuseIdentifier:@"rightcell"];
[self createHeaderview];
} }
#pragma mark -头部视图
- (void)createHeaderview
{
UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, RightWidth, 200)];
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 80)];
imageView.center = CGPointMake(RightWidth/2, 100);
imageView.image = TCImage(@"weibo");
[headerView addSubview:imageView];
self.rightTableview.tableHeaderView = headerView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"rightcell" forIndexPath:indexPath];
cell.textLabel.text = [self.dataArray objectAtIndex_opple:indexPath.row];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.dataArray.count;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
//
// ShoppingTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ShoppingTableViewCell : UITableViewCell
/**
* 选中
*/
@property (weak, nonatomic) IBOutlet UIButton *selectedButton;
/**
* 商品图片
*/
@property (weak, nonatomic) IBOutlet UIImageView *goodsImageView;
/**
* 商品信息
*/
@property (weak, nonatomic) IBOutlet UILabel *goodsInformationLabe;
/**
* 吊牌价格
*/
@property (weak, nonatomic) IBOutlet UILabel *tagsPriceLabe;
/**
* 成交价格
*/
@property (weak, nonatomic) IBOutlet UITextField *clinchTextfield;
/**
* 商品数量
*/
@property (weak, nonatomic) IBOutlet UILabel *goodsNumbersLabe;
/**
* 产品金额
*/
@property (weak, nonatomic) IBOutlet UILabel *productPriceLabe;
@end
//
// ShoppingTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "ShoppingTableViewCell.h"
@implementation ShoppingTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
#pragma mark -增加或者减少商品
- (IBAction)reduceAndaddButtonClick:(UIButton *)sender {
//sender.tag == 100 减少
//sender.tag == 101 增加
}
#pragma mark -商品选中
- (IBAction)selectedButtonClick:(UIButton *)sender {
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
...@@ -10,4 +10,26 @@ ...@@ -10,4 +10,26 @@
@interface ShoppingViewController : BaseViewController @interface ShoppingViewController : BaseViewController
/**
* 结算按钮
*/
@property (weak, nonatomic) IBOutlet UIButton *settlementButton;
/**
* 合计金额
*/
@property (weak, nonatomic) IBOutlet UILabel *totalpriceLabe;
/**
* 合计数量
*/
@property (weak, nonatomic) IBOutlet UILabel *totalNumbersLabe;
/**
* 全选
*/
@property (weak, nonatomic) IBOutlet UIButton *allSelectedButton;
@end @end
...@@ -7,20 +7,96 @@ ...@@ -7,20 +7,96 @@
// //
#import "ShoppingViewController.h" #import "ShoppingViewController.h"
#import "ShoppingTableViewCell.h"
#import "AppDelegate.h"
@interface ShoppingViewController ()<UITableViewDelegate,UITableViewDataSource>
@interface ShoppingViewController ()
@property (weak, nonatomic) IBOutlet UITableView *shoppingTableview;
@property (nonatomic,strong) NSMutableArray *datasArray;
@end @end
@implementation ShoppingViewController @implementation ShoppingViewController
/**
* 数据源
*/
- (NSMutableArray *)datasArray
{
if (_datasArray == nil) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
[self uiConfigAction];
}
#pragma mark - UI
- (void)uiConfigAction
{
self.shoppingTableview.dataSource = self;
self.shoppingTableview.delegate = self;
self.shoppingTableview.tableFooterView = [UIView new];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ShoppingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Shopping" forIndexPath:indexPath];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 20;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.shoppingTableview deselectRowAtIndexPath:indexPath animated:YES];
} }
#pragma mark -结算
- (IBAction)settlementButtonClick:(UIButton *)sender {
}
#pragma mark -全选
- (IBAction)allSelectedButtonClick:(id)sender {
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -9,33 +9,86 @@ ...@@ -9,33 +9,86 @@
#import "CustomTabbarController.h" #import "CustomTabbarController.h"
#import "Toolview.h" #import "Toolview.h"
#import "ClientViewController.h"
@interface CustomTabbarController () @interface CustomTabbarController ()<TabbarButtonClickdelegate>
@property (nonatomic,strong) NSArray *identifierArray;
@property (nonatomic,strong) NSArray *controllerArray;
@end @end
@implementation CustomTabbarController @implementation CustomTabbarController
/**
* UIStoryboard Identifier数组
*
* @return NSArary
*/
- (NSArray *)identifierArray
{
if (_identifierArray == nil) {
_identifierArray = [NSArray arrayWithObjects:@"shopping",@"Client", nil];
}
return _identifierArray
;
}
- (NSArray *)controllerArray
{
if (_controllerArray == nil) {
_controllerArray = [NSArray arrayWithObjects:@"ShoppingViewController",@"ClientViewController", nil];
}
return _controllerArray;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
[self uiConfigAction];
[self addViewcontroller];
}
#pragma mark -UI
- (void)uiConfigAction
{
self.tabBar.frame = CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight); self.tabBar.frame = CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight);
Toolview *toolview = [[Toolview alloc]initWithFrame:CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight)]; Toolview *toolview = [[Toolview alloc]initWithFrame:CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight)];
toolview.delegate = self;
[self.tabBar addSubview:toolview]; [self.tabBar addSubview:toolview];
}
#pragma mark -添加controller
- (void)addViewcontroller
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
ShoppingViewController *shoppingVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray firstObject]];
ClientViewController *clientVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:1]];
NSArray *vcArray = [NSArray arrayWithObjects:clientVC,shoppingVC, nil];
self.viewControllers = vcArray;
}
#pragma amrk -TabbarButtonClickdelegate代理
- (void)ButtonClickAction:(NSInteger)Buttontag
{
if (Buttontag == 101) {
ClientViewController *client = [storyboard instantiateViewControllerWithIdentifier:@"Client"]; self.selectedIndex = 0;
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:client];
NSArray *arr = @[nav];
self.viewControllers = arr;
}else if (Buttontag == 102){
self.selectedIndex = 1;
}
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -8,6 +8,25 @@ ...@@ -8,6 +8,25 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@protocol TabbarButtonClickdelegate <NSObject>
@required
/**
* 点击按钮回调
*/
- (void)ButtonClickAction:(NSInteger)Buttontag;
@end
@interface Toolview : UIView @interface Toolview : UIView
@property (nonatomic,assign) id<TabbarButtonClickdelegate> delegate;
/**
* 下划线
*/
@property (nonatomic,strong) UIView *underlineView;
@end @end
...@@ -37,19 +37,64 @@ ...@@ -37,19 +37,64 @@
#pragma mark -布局 #pragma mark -布局
- (void)uiConfigAction - (void)uiConfigAction
{ {
for (int i=1; i<5; i++) { //阴影
self.layer.shadowColor = [UIColor blackColor].CGColor;
self.layer.shadowRadius = 6;
self.layer.shadowOpacity = 0.8;
//图标
UIImageView *iconImage = [[UIImageView alloc]initWithFrame:CGRectMake(50, 10, 100, 45)];
iconImage.image = TCImage(@"weibo");
[self addSubview:iconImage];
//输入框
UITextField *inputField = [[UITextField alloc]initWithFrame:CGRectMake(200, (NavigationHeight-35)/2, 300, 35)];
inputField.borderStyle = UITextBorderStyleNone;
inputField.backgroundColor = [UIColor grayColor];
inputField.placeholder = @"请输入关键字";
[self addSubview:inputField];
//按钮
NSArray *titleArray = [NSArray arrayWithObjects:@"某某用户",@"我的客户",@"购物车", nil];
for (int i=1; i<4; i++) {
CustomButton *button = [CustomButton buttonWithType:UIButtonTypeCustom]; CustomButton *button = [CustomButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(ScreenWidth-(i*ButtonWIDTH + Buttoninterval*(i-1)), 10, ButtonWIDTH, ButtonRIGHT); button.frame = CGRectMake(ScreenWidth-(i*ButtonWIDTH + Buttoninterval*(i-1)), 10, ButtonWIDTH, ButtonRIGHT);
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[button setTitle:@"购物车" forState:UIControlStateNormal]; [button setTitle:[titleArray objectAtIndex_opple:i-1] forState:UIControlStateNormal];
button.tag = 100+i-1;
[button addTarget:self action:@selector(ButtonClick:) forControlEvents:UIControlEventTouchUpInside];
button.instructionsNumber = i;
[button setImage:TCImage(@"qq") forState:UIControlStateNormal]; [button setImage:TCImage(@"qq") forState:UIControlStateNormal];
[self addSubview:button]; [self addSubview:button];
//创建下划线
if (i == 2) {
self.underlineView = [[UIView alloc]initWithFrame:CGRectMake(button.frame.origin.x+(ButtonWIDTH-50)/2, ButtonRIGHT+9, 50, 1)];
_underlineView.backgroundColor = [UIColor redColor];
[self addSubview:self.underlineView];
}
} }
} }
#pragma mark -按钮事件响应
- (void)ButtonClick:(UIButton *)button
{
//下划线动画
[UIView animateWithDuration:0.2 animations:^{
self.underlineView.frame = CGRectMake(button.frame.origin.x+(ButtonWIDTH-50)/2, ButtonRIGHT+9, 50, 1);
}];
//点击代理
if ([self.delegate respondsToSelector:@selector(ButtonClickAction:)]) {
[self.delegate ButtonClickAction:button.tag];
}
}
......
This diff is collapsed.
...@@ -17,12 +17,19 @@ ...@@ -17,12 +17,19 @@
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
/** /**
* 网络状态 * 网络状态
*/ */
@property (nonatomic,assign) BOOL Networkstatus; @property (nonatomic,assign) BOOL Networkstatus;
/**
* 抽屉控制器对象
*/
@property (nonatomic,strong) MMDrawerController *mmdrawer;
- (void)saveContext; - (void)saveContext;
- (NSURL *)applicationDocumentsDirectory; - (NSURL *)applicationDocumentsDirectory;
......
...@@ -10,4 +10,15 @@ ...@@ -10,4 +10,15 @@
@interface CustomButton : UIButton @interface CustomButton : UIButton
@property (nonatomic,strong) UILabel *instructions;
/**
* 数量指示
*/
@property (nonatomic,assign) NSInteger instructionsNumber;
@end @end
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
// //
#import "CustomButton.h" #import "CustomButton.h"
#import "instructionsLabe.h"
#define WIDTH self.frame.size.width #define WIDTH self.frame.size.width
@implementation CustomButton @implementation CustomButton
/* /*
// Only override drawRect: if you perform custom drawing. // Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation. // An empty implementation adversely affects performance during animation.
...@@ -21,6 +23,7 @@ ...@@ -21,6 +23,7 @@
*/ */
- (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithFrame:(CGRect)frame
{ {
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
...@@ -33,6 +36,26 @@ ...@@ -33,6 +36,26 @@
} }
- (void)setInstructionsNumber:(NSInteger)instructionsNumber
{
_instructionsNumber = instructionsNumber;
for (UIView *subview in self.subviews) {
if ([subview isKindOfClass:[instructionsLabe class]]) {
[subview removeFromSuperview];
break;
}
}
instructionsLabe *labe = [[instructionsLabe alloc]initWithFrame:CGRectMake(WIDTH-35, 0, 13, 13)];
labe.instructionsNumber = _instructionsNumber;
[self addSubview:labe];
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect - (CGRect)imageRectForContentRect:(CGRect)contentRect
{ {
return CGRectMake((WIDTH-30)/2, 0, 30, 30); return CGRectMake((WIDTH-30)/2, 0, 30, 30);
......
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// 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, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "MMDrawerVisualState.h"
typedef NS_ENUM(NSInteger, MMDrawerAnimationType){
MMDrawerAnimationTypeNone,
MMDrawerAnimationTypeSlide,
MMDrawerAnimationTypeSlideAndScale,
MMDrawerAnimationTypeSwingingDoor,
MMDrawerAnimationTypeParallax,
};
@interface MMExampleDrawerVisualStateManager : NSObject
@property (nonatomic,assign) MMDrawerAnimationType leftDrawerAnimationType;
@property (nonatomic,assign) MMDrawerAnimationType rightDrawerAnimationType;
+ (MMExampleDrawerVisualStateManager *)sharedManager;
-(MMDrawerControllerDrawerVisualStateBlock)drawerVisualStateBlockForDrawerSide:(MMDrawerSide)drawerSide;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// 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, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MMExampleDrawerVisualStateManager.h"
#import <QuartzCore/QuartzCore.h>
@implementation MMExampleDrawerVisualStateManager
+ (MMExampleDrawerVisualStateManager *)sharedManager {
static MMExampleDrawerVisualStateManager *_sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedManager = [[MMExampleDrawerVisualStateManager alloc] init];
[_sharedManager setLeftDrawerAnimationType:MMDrawerAnimationTypeParallax];
[_sharedManager setRightDrawerAnimationType:MMDrawerAnimationTypeParallax];
});
return _sharedManager;
}
-(MMDrawerControllerDrawerVisualStateBlock)drawerVisualStateBlockForDrawerSide:(MMDrawerSide)drawerSide{
MMDrawerAnimationType animationType;
if(drawerSide == MMDrawerSideLeft){
animationType = self.leftDrawerAnimationType;
}
else {
animationType = self.rightDrawerAnimationType;
}
MMDrawerControllerDrawerVisualStateBlock visualStateBlock = nil;
switch (animationType) {
case MMDrawerAnimationTypeSlide:
visualStateBlock = [MMDrawerVisualState slideVisualStateBlock];
break;
case MMDrawerAnimationTypeSlideAndScale:
visualStateBlock = [MMDrawerVisualState slideAndScaleVisualStateBlock];
break;
case MMDrawerAnimationTypeParallax:
visualStateBlock = [MMDrawerVisualState parallaxVisualStateBlockWithParallaxFactor:2.0];
break;
case MMDrawerAnimationTypeSwingingDoor:
visualStateBlock = [MMDrawerVisualState swingingDoorVisualStateBlock];
break;
default:
visualStateBlock = ^(MMDrawerController * drawerController, MMDrawerSide drawerSide, CGFloat percentVisible){
UIViewController * sideDrawerViewController;
CATransform3D transform;
CGFloat maxDrawerWidth = 0.0;
if(drawerSide == MMDrawerSideLeft){
sideDrawerViewController = drawerController.leftDrawerViewController;
maxDrawerWidth = drawerController.maximumLeftDrawerWidth;
}
else if(drawerSide == MMDrawerSideRight){
sideDrawerViewController = drawerController.rightDrawerViewController;
maxDrawerWidth = drawerController.maximumRightDrawerWidth;
}
if(percentVisible > 1.0){
transform = CATransform3DMakeScale(percentVisible, 1.f, 1.f);
if(drawerSide == MMDrawerSideLeft){
transform = CATransform3DTranslate(transform, maxDrawerWidth*(percentVisible-1.f)/2, 0.f, 0.f);
}else if(drawerSide == MMDrawerSideRight){
transform = CATransform3DTranslate(transform, -maxDrawerWidth*(percentVisible-1.f)/2, 0.f, 0.f);
}
}
else {
transform = CATransform3DIdentity;
}
[sideDrawerViewController.view.layer setTransform:transform];
};
break;
}
return visualStateBlock;
}
@end
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#import "IQKeyboardManager.h" #import "IQKeyboardManager.h"
#import "AFNetworking.h" #import "AFNetworking.h"
#import "NetworkRequestClassManager.h" #import "NetworkRequestClassManager.h"
#import "NSArray+Objectwithindex.h"
#import "ShoppingViewController.h"
#import "ClientViewController.h"
// Include any system framework and library headers here that should be included in all compilation units. // Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
......
//
// instructionsLabe.h
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface instructionsLabe : UILabel
/**
* 显示指示器的数量
*/
@property (nonatomic,assign) NSInteger instructionsNumber;
@end
//
// instructionsLabe.m
// Lighting
//
// Created by 曹云霄 on 16/4/29.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "instructionsLabe.h"
@implementation instructionsLabe
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.layer.masksToBounds = YES;
self.layer.cornerRadius = self.frame.size.width/2;
self.backgroundColor = [UIColor redColor];
self.textColor = [UIColor whiteColor];
self.font = [UIFont systemFontOfSize:8];
self.textAlignment = NSTextAlignmentCenter;
}
return self;
}
- (void)setInstructionsNumber:(NSInteger)instructionsNumber
{
_instructionsNumber = instructionsNumber;
self.text = [NSString stringWithFormat:@"%ld",_instructionsNumber];
}
@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