Commit c2758b36 authored by Sandy's avatar Sandy

订单管理界面、订单详情界面顶部视图自适应内容高度

parent 3aba241b
This diff is collapsed.
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "order_state_noPayment.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "order_state_noPayment@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "call_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "call_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "order_state.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "order_state@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "call_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "call_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "order_state_unstasport.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "order_state_unstasport@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "state_unstasport.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "state_unstasport@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "order_state_transported.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "order_state_transported@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#import "UIView+Category.h" #import "UIView+Category.h"
#import "ManagementViewController.h" #import "ManagementViewController.h"
#import "CommodityManagementViewController.h" #import "CommodityManagementViewController.h"
#import "AddCommodityViewController.h"
@interface CommodityManagementTopView () @interface CommodityManagementTopView ()
@property (weak, nonatomic) IBOutlet UIButton *buttonAdd; @property (weak, nonatomic) IBOutlet UIButton *buttonAdd;
@property (weak, nonatomic) IBOutlet UIButton *buttonManagement; @property (weak, nonatomic) IBOutlet UIButton *buttonManagement;
...@@ -33,6 +34,10 @@ ...@@ -33,6 +34,10 @@
} }
- (IBAction)addAct:(id)sender { - (IBAction)addAct:(id)sender {
[self hideSortView]; [self hideSortView];
AddCommodityViewController *addVC = [[AddCommodityViewController alloc] init];
addVC.hidesBottomBarWhenPushed = YES;
[[self viewController].navigationController pushViewController:addVC animated:YES];
CLog(@"a"); CLog(@"a");
} }
- (void)hideSortView { - (void)hideSortView {
......
...@@ -39,14 +39,14 @@ ...@@ -39,14 +39,14 @@
<color key="textColor" red="1" green="0.3921568627" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="1" green="0.3921568627" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="佣金" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ovJ-rr-g9w"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="佣金:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ovJ-rr-g9w">
<rect key="frame" x="174" y="69" width="57" height="23"/> <rect key="frame" x="174" y="69" width="44" height="23"/>
<fontDescription key="fontDescription" type="system" pointSize="19"/> <fontDescription key="fontDescription" type="system" pointSize="19"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥9.8" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eSJ-Pe-NgQ"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥9.8" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eSJ-Pe-NgQ">
<rect key="frame" x="231" y="69" width="50" height="24"/> <rect key="frame" x="218" y="69" width="50" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/> <fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
......
//
// OrderCellView.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderCellView : UIView
@end
//
// OrderCellView.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderCellView.h"
@implementation OrderCellView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@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"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="320" height="140"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="commodityManagementImage" translatesAutoresizingMaskIntoConstraints="NO" id="gvZ-Yx-Ujy">
<rect key="frame" x="8" y="8" width="90" height="121"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="92I-IA-f2F"/>
<constraint firstAttribute="height" constant="81" id="C9T-Ih-pvI"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="90" id="oly-J2-P6X"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="C9T-Ih-pvI"/>
</mask>
</variation>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bloem天然草本更年期综合营养 胶囊100粒 " textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dhI-dB-05Q">
<rect key="frame" x="106" y="8" width="206" height="41"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="96粒" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bGv-K4-Dnw">
<rect key="frame" x="106" y="82" width="43" height="23"/>
<fontDescription key="fontDescription" type="system" pointSize="19"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OR2-4k-rSi">
<rect key="frame" x="157" y="82" width="21" height="23"/>
<fontDescription key="fontDescription" type="system" pointSize="19"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="售价:¥279" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vW8-v5-AfH">
<rect key="frame" x="106" y="108" width="98" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="acf-qI-3N1">
<rect key="frame" x="8" y="138" width="304" height="1"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="23G-ad-XsJ"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="1" id="Z3D-fb-vaB"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="bGv-K4-Dnw" firstAttribute="leading" secondItem="dhI-dB-05Q" secondAttribute="leading" id="0l8-KH-vVl"/>
<constraint firstAttribute="trailingMargin" secondItem="dhI-dB-05Q" secondAttribute="trailing" id="8t4-X9-fTa"/>
<constraint firstItem="dhI-dB-05Q" firstAttribute="leading" secondItem="gvZ-Yx-Ujy" secondAttribute="trailing" constant="8" id="DyV-JN-MBh"/>
<constraint firstItem="gvZ-Yx-Ujy" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leadingMargin" id="E1r-kk-ilm"/>
<constraint firstItem="vW8-v5-AfH" firstAttribute="top" secondItem="bGv-K4-Dnw" secondAttribute="bottom" constant="3" id="TUm-3B-rCo"/>
<constraint firstItem="vW8-v5-AfH" firstAttribute="bottom" secondItem="gvZ-Yx-Ujy" secondAttribute="bottom" id="Vyg-Eu-u0I"/>
<constraint firstItem="gvZ-Yx-Ujy" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="topMargin" id="Wka-bt-cZs"/>
<constraint firstItem="vW8-v5-AfH" firstAttribute="leading" secondItem="bGv-K4-Dnw" secondAttribute="leading" id="Wps-v8-DZG"/>
<constraint firstItem="acf-qI-3N1" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="XW2-I5-FBt"/>
<constraint firstItem="OR2-4k-rSi" firstAttribute="leading" secondItem="bGv-K4-Dnw" secondAttribute="trailing" constant="8" id="ZRX-DE-Tgo"/>
<constraint firstAttribute="bottomMargin" secondItem="gvZ-Yx-Ujy" secondAttribute="bottom" constant="3" id="cJq-F0-J8w"/>
<constraint firstItem="dhI-dB-05Q" firstAttribute="top" secondItem="gvZ-Yx-Ujy" secondAttribute="top" id="g7A-BG-g7x"/>
<constraint firstAttribute="trailing" secondItem="acf-qI-3N1" secondAttribute="trailing" constant="8" id="qgd-jV-kN7"/>
<constraint firstItem="OR2-4k-rSi" firstAttribute="centerY" secondItem="bGv-K4-Dnw" secondAttribute="centerY" id="qiC-Hv-sB8"/>
<constraint firstAttribute="bottom" secondItem="acf-qI-3N1" secondAttribute="bottom" constant="1" id="zcZ-yg-SPG"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="252" y="351"/>
</view>
</objects>
<resources>
<image name="commodityManagementImage" width="185" height="185"/>
</resources>
</document>
//
// OrderDetailTopView.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderDetailTopView : UIView
@property (weak, nonatomic) IBOutlet UILabel *labelAddress;
@property (nonatomic) CGFloat viewHeight;
- (CGFloat)viewHeight;
@end
//
// OrderDetailTopView.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderDetailTopView.h"
@interface OrderDetailTopView ()
@property (weak, nonatomic) IBOutlet UILabel *labelBottom;
@property (weak, nonatomic) IBOutlet UIView *labelLastView;
@end
@implementation OrderDetailTopView
- (void)awakeFromNib {
}
- (CGFloat)viewHeight {
return self.labelLastView.bottom;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
This diff is collapsed.
//
// OrderTableViewCell.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OrderTableViewCell : UITableViewCell
- (void)cellWithViewNumber:(NSInteger)number;
- (void)setState:(NSString *)orderState;
@end
//
// OrderTableViewCell.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderTableViewCell.h"
#import "OrderCellView.h"
@interface OrderTableViewCell ()
@property (nonatomic, strong) NSMutableArray *arrCellView;
@property (weak, nonatomic) IBOutlet UILabel *labelState;
@end
@implementation OrderTableViewCell
- (void)awakeFromNib {
// Initialization code
self.arrCellView = [NSMutableArray array];
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
- (void)cellWithViewNumber:(NSInteger)number {
//[self.contentView removeAllSubViews];
for (OrderCellView *cellView in self.arrCellView) {
[cellView removeFromSuperview];
}
// //1.获取一个全局串行队列
// dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
// //2.把任务添加到队列中执行
// dispatch_async(queue, ^{
//
// //打印当前线程
// CLog(@"%@",[NSThread currentThread]);
//
for (NSInteger i = 0; i < number; i++) {
OrderCellView *cellView = [OrderCellView viewWithNibName:@"OrderCellView"];
cellView.frame = CGRectMake(0, 74 + 120 * i, self.width, 120);
// //回到主线程,展示图片
// dispatch_async(dispatch_get_main_queue(), ^{
// //打印当前线程
// CLog(@"%@",[NSThread currentThread]);
[self.arrCellView addObject:cellView];
[self.contentView addSubview:cellView];
// });
//
}
// });
}
- (void)setState:(NSString *)orderState {
self.labelState.text = orderState;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
This diff is collapsed.
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
if (section == 0) { if (section == 0) {
return 3; return 3;
}else{ }else{
return 8; return 6;
} }
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import "AddCommodityViewController.h" #import "AddCommodityViewController.h"
#import "SDCycleScrollView.h" #import "SDCycleScrollView.h"
#import "CommodityManagementViewController.h" #import "CommodityManagementViewController.h"
#import "OrderViewController.h"
#define kHomeCollectionViewID @"HomeCollectionViewID" #define kHomeCollectionViewID @"HomeCollectionViewID"
#define kCollectionViewHeadHeight 350 #define kCollectionViewHeadHeight 350
...@@ -115,7 +116,7 @@ ...@@ -115,7 +116,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://商品管理
{ {
CommodityManagementViewController *managementVC = [[CommodityManagementViewController alloc] init]; CommodityManagementViewController *managementVC = [[CommodityManagementViewController alloc] init];
managementVC.hidesBottomBarWhenPushed = YES; managementVC.hidesBottomBarWhenPushed = YES;
...@@ -123,7 +124,12 @@ ...@@ -123,7 +124,12 @@
} }
break; break;
case 1: case 1://订单管理
{
OrderViewController *orderVC = [[OrderViewController alloc] init];
orderVC.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:orderVC animated:YES];
}
break; break;
case 2: case 2:
......
//
// CanceledTableViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CanceledTableViewController : UITableViewController
@end
//
// CanceledTableViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "CanceledTableViewController.h"
#import "OrderTableViewCell.h"
#define kCellId @"OrderTableViewCell.h"
@interface CanceledTableViewController ()
@property (nonatomic, strong) NSArray *array;
@end
@implementation CanceledTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.array = @[@2,@3,@5,@10];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 115 + 130 * [self.array[indexPath.row] integerValue];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return self.array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
// Configure the cell...
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell setState:@"已取消"];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#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
//
// CommpleteTableViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CommpleteTableViewController : UITableViewController
@end
//
// CommpleteTableViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "CommpleteTableViewController.h"
#import "OrderTableViewCell.h"
#define kCellId @"OrderTableViewCell.h"
@interface CommpleteTableViewController ()
@property (nonatomic, strong) NSArray *array;
@end
@implementation CommpleteTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.array = @[@2,@3,@5,@10];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 115 + 130 * [self.array[indexPath.row] integerValue];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return self.array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
// Configure the cell...
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell setState:@"已完成"];
return cell;
}
@end
//
// NoPaymentTableViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NoPaymentTableViewController : UITableViewController
@property (nonatomic, copy) NSString *state;
@end
//
// NoPaymentTableViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "NoPaymentTableViewController.h"
#import "OrderTableViewCell.h"
#import "OrderDetailViewController.h"
#define kCellId @"OrderTableViewCell.h"
@interface NoPaymentTableViewController ()
@property (nonatomic, strong) NSArray *array;
@end
@implementation NoPaymentTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.array = @[@2,@3,@5,@10];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 115 + 120 * [self.array[indexPath.row] integerValue];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return self.array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
// Configure the cell...
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell setState:@"待支付"];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
OrderDetailViewController *orderDetailVC = [[OrderDetailViewController alloc] init];
[self.navigationController pushViewController:orderDetailVC animated:YES];
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#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
//
// OrderDetailViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface OrderDetailViewController : IBTUIViewController
@end
//
// OrderDetailViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderDetailViewController.h"
#import "OrderDetailTopView.h"
#import "NSString+Category.h"
@interface OrderDetailViewController ()
@property (nonatomic, strong) UITableView *tableView;
@end
@implementation OrderDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = kCustomGreenColor;
self.navigationItem.title = @"订单详情";
OrderDetailTopView *topView = [OrderDetailTopView viewWithNibName:@"OrderDetailTopView"];
topView.width = kWidth;
topView.labelAddress.text = [NSString randomTestText];
[self.view addSubview:topView];
CLog(@"%f",topView.viewHeight);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
topView.labelAddress.text = [NSString randomTestText];
CLog(@"%f",topView.viewHeight);
});
// Do any additional setup after loading the view.
}
- (void)setUpTableView {
}
- (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
//
// OrderViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface OrderViewController : IBTUIViewController
@end
//
// OrderViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "OrderViewController.h"
#import "JavenMultipleViewWithHeader.h"
#import "NoPaymentTableViewController.h"
#import "WaitForDispatchTableViewController.h"
#import "TransportedTableViewController.h"
#import "CommpleteTableViewController.h"
#import "CanceledTableViewController.h"
@interface OrderViewController ()
@property (nonatomic, strong) JavenMultipleViewWithHeader *viewMutiple;
@end
@implementation OrderViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"订单管理";
[self setUpView];
// Do any additional setup after loading the view.
}
- (void)setUpView {
NoPaymentTableViewController *noPayMentVC = [[NoPaymentTableViewController alloc] init];
WaitForDispatchTableViewController *waitVC = [[WaitForDispatchTableViewController alloc] init];
TransportedTableViewController *transportedVC = [[TransportedTableViewController alloc] init];
CommpleteTableViewController *completeVC = [[CommpleteTableViewController alloc] init];
CanceledTableViewController *cancelVC = [[CanceledTableViewController alloc] init];
NSArray *arrVC = @[noPayMentVC, waitVC, transportedVC, completeVC, cancelVC];
NSArray *arrTitle = @[@"代支付",@"待发货",@"已发货",@"已完成",@"已取消"];
_viewMutiple = [[JavenMultipleViewWithHeader alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)
views:arrVC
titles: arrTitle
target:self
selectTextColor:kCustomGreenColor
selectBackgroundColor:kBacroundColor
textColor:kTextColorBlack
backgroundColor:kBacroundColor
titleHeight:40
titleBtnWidth:kWidth / arrTitle.count];
[self.view addSubview:_viewMutiple];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO];
}
- (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
//
// TransportedTableViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TransportedTableViewController : UITableViewController
@end
//
// TransportedTableViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "TransportedTableViewController.h"
#import "OrderTableViewCell.h"
#define kCellId @"OrderTableViewCell.h"
@interface TransportedTableViewController ()
@property (nonatomic, strong) NSArray *array;
@end
@implementation TransportedTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.array = @[@2,@3,@5,@10];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 115 + 130 * [self.array[indexPath.row] integerValue];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return self.array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
// Configure the cell...
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell setState:@"已发货"];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#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
//
// WaitForDispatchTableViewController.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface WaitForDispatchTableViewController : UITableViewController
@end
//
// WaitForDispatchTableViewController.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "WaitForDispatchTableViewController.h"
#import "OrderTableViewCell.h"
#define kCellId @"OrderTableViewCell.h"
@interface WaitForDispatchTableViewController ()
@property (nonatomic, strong) NSArray *array;
@end
@implementation WaitForDispatchTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.array = @[@2,@3,@5,@10];
[self.tableView registerNib:[UINib nibWithNibName:@"OrderTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellId];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 115 + 130 * [self.array[indexPath.row] integerValue];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return self.array.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
// Configure the cell...
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell setState:@"待发货"];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#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
//
// NSString+Category.h
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (Category)
+ (NSString *)randomTestText;
@end
//
// NSString+Category.m
// ALand
//
// Created by Z on 16/3/30.
// Copyright © 2016年 Z. All rights reserved.
//
#import "NSString+Category.h"
@implementation NSString (Category)
+ (NSString *)randomTestText {
//NSString *str = @"长短不一的测试数据";
NSMutableString *result = [NSMutableString string];
int randomNumber = arc4random()%10 + 1;
for (int i = 0; i < randomNumber; i++) {
[result appendString:@"长短不一的测试数据"];
}
return result;
}
@end
//
// JavenMultipleViewWithHeader.h
// multipleView
//
// Created by Z on 16/3/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JavenMultipleViewWithHeader : UIView<UIScrollViewDelegate>
- (instancetype)initWithFrame:(CGRect)frame views:(NSArray *)views titles:(NSArray *)titles target:(id)target selectTextColor:(UIColor *)selectTextColor selectBackgroundColor:(UIColor *)selectBackgroundColor textColor:(UIColor *)textColor backgroundColor:(UIColor *)abackgroundColor titleHeight:(CGFloat)height titleBtnWidth:(CGFloat)width;
@end
//
// JavenMultipleViewWithHeader.m
// multipleView
//
// Created by Z on 16/3/15.
// Copyright © 2016年 Z. All rights reserved.
//
#import "JavenMultipleViewWithHeader.h"
@interface JavenMultipleViewWithHeader ()
@property (nonatomic, strong) UIScrollView *viewScrollView;
@property (nonatomic, strong) NSArray *viewArr;
@property (nonatomic, strong) NSArray *titleArr;
@property (nonatomic, strong) NSMutableArray *buttonArr;
@property (nonatomic, strong) UIColor *selectTextColor;
@property (nonatomic, strong) UIColor *selectBackgroundColor;
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIColor *abackgroundColor;
@property (nonatomic, strong) UIColor *forceColor;
@property (nonatomic, strong) UIColor *normalColor;
@property (nonatomic, assign) CGFloat titleButtonWith;
@property (nonatomic, assign) CGFloat titleScrollViewHeight;
@property (nonatomic, strong) UIView *bottomFlowView;
@end
@implementation JavenMultipleViewWithHeader
- (instancetype)initWithFrame:(CGRect)frame views:(NSArray *)views titles:(NSArray *)titles target:(id)target selectTextColor:(UIColor *)selectTextColor selectBackgroundColor:(UIColor *)selectBackgroundColor textColor:(UIColor *)textColor backgroundColor:(UIColor *)abackgroundColor titleHeight:(CGFloat)height titleBtnWidth:(CGFloat)width{
self = [super initWithFrame:frame];
if (self) {
_selectTextColor = selectTextColor;
_selectBackgroundColor = selectBackgroundColor;
_textColor = textColor;
_abackgroundColor = abackgroundColor;
_titleButtonWith = width;
_titleScrollViewHeight = height;
self.backgroundColor = kCutLineColorLiteGray;
_viewArr = views;
_titleArr = titles;
//set titleButton
UIScrollView *titleScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, _titleScrollViewHeight)];
titleScrollView.backgroundColor = kCutLineColorLiteGray;
titleScrollView.tag = 111000;
titleScrollView.delegate = self;
titleScrollView.contentSize = CGSizeMake(_titleButtonWith * titles.count, 0);
titleScrollView.showsHorizontalScrollIndicator = NO;//水平进度条
[self addSubview:titleScrollView];
UIView *viewLineTop = [[UIView alloc] initWithFrame:CGRectMake(0, 0, titleScrollView.width, 1)];
viewLineTop.backgroundColor = kCutLineColorLiteGray;
[self addSubview:viewLineTop];
UIView *viewLineBottom = [UIView new];
viewLineBottom.backgroundColor = kCutLineColorLiteGray;
[self addSubview:viewLineBottom];
viewLineBottom.sd_layout.leftEqualToView(self).rightEqualToView(self).bottomEqualToView(titleScrollView).heightIs(1);
_buttonArr = [NSMutableArray array];
for (int i = 0; i < titles.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:titles[i] forState:UIControlStateNormal];
button.titleLabel.font = [UIFont systemFontOfSize:16];
[button setTitleColor:_textColor forState:UIControlStateNormal];
button.backgroundColor = _abackgroundColor;
if (i == 0) {
[button setTitleColor:_selectTextColor forState:UIControlStateNormal];
[button setBackgroundColor:_selectBackgroundColor];
}
button.frame = CGRectMake(_titleButtonWith * i, 0, _titleButtonWith, _titleScrollViewHeight);
[_buttonArr addObject:button];
button.tag = 11100 + i;
[button addTarget:self action:@selector(changeToSelectedView:) forControlEvents:UIControlEventTouchUpInside];
[titleScrollView addSubview:button];
}
UIScrollView *viewScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, _titleScrollViewHeight, frame.size.width, frame.size.height - _titleScrollViewHeight)];
NSLog(@"height = %f, y = %f", viewScrollView.frame.size.height, viewScrollView.frame.origin.y
);
_viewScrollView = viewScrollView;
viewScrollView.showsVerticalScrollIndicator = NO;
viewScrollView.delegate = self;
viewScrollView.pagingEnabled = YES;
viewScrollView.tag = 111001;
viewScrollView.contentSize = CGSizeMake(frame.size.width * titles.count, 0);
[self addSubview:viewScrollView];
for (int i = 0; i < views.count; i++) {
UIViewController *viewController = views[i];
[[self viewController] addChildViewController:viewController];
viewController.view.frame = CGRectMake(frame.size.width * i, 0, frame.size.width, frame.size.height - _titleScrollViewHeight);
[target addChildViewController:viewController];
[viewScrollView addSubview:viewController.view];
}
_bottomFlowView = [[UIView alloc] initWithFrame:CGRectMake(0, _titleScrollViewHeight - 3, _titleButtonWith, 3)];
_bottomFlowView.backgroundColor = _selectTextColor;
[titleScrollView addSubview:_bottomFlowView];
}
return self;
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if (scrollView.tag == 111001) {
NSLog(@"%f",scrollView.contentOffset.y);
for (UIButton *btn in _buttonArr) {
if (btn.tag == scrollView.contentOffset.x / self.frame.size.width + 11100) {
[btn setTitleColor:_selectTextColor forState:UIControlStateNormal];
btn.backgroundColor = _selectBackgroundColor;
WS(weakSelf)
[UIView animateWithDuration:0.3 animations:^{
weakSelf.bottomFlowView.centerX = btn.centerX;
}];
}else{
[btn setTitleColor:_textColor forState:UIControlStateNormal];
btn.backgroundColor = _abackgroundColor;
}
}
}
}
- (void)changeToSelectedView:(UIButton *)btn {
for (UIButton *button in _buttonArr) {
button.backgroundColor = _abackgroundColor;
[button setTitleColor:_textColor forState:UIControlStateNormal];
}
WS(weakSelf)
[UIView animateWithDuration:0.3 animations:^{
weakSelf.bottomFlowView.centerX = btn.centerX;
}];
[btn setBackgroundColor:_selectBackgroundColor];
[btn setTitleColor:_selectTextColor forState:UIControlStateNormal];
NSInteger currentIndex = btn.tag - 11100;
//_viewScrollView.contentOffset = CGPointMake(currentIndex * self.frame.size.width, 0);
[_viewScrollView setContentOffset:CGPointMake(currentIndex * self.frame.size.width, 0) animated:YES];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
UIBarButtonItem *leftBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"bac"] style:UIBarButtonItemStyleDone target:self action:@selector(popAction)]; UIBarButtonItem *leftBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"bac"] style:UIBarButtonItemStyleDone target:self action:@selector(popAction)];
leftBtn.tintColor = kTextColorDarkGray; leftBtn.tintColor = kTextColorDarkGray;
self.navigationItem.leftBarButtonItem = leftBtn; self.navigationItem.leftBarButtonItem = leftBtn;
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:24],NSFontAttributeName, [UIColor colorWithHexString:@"333333"], NSForegroundColorAttributeName,nil]]; [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:21],NSFontAttributeName, [UIColor colorWithHexString:@"333333"], NSForegroundColorAttributeName,nil]];
self.automaticallyAdjustsScrollViewInsets = NO; self.automaticallyAdjustsScrollViewInsets = NO;
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
......
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