ProductListViewContrller complete

This commit is contained in:
2014-08-13 11:44:54 +08:00
parent ca89d76411
commit aefb6b1d81
10 changed files with 162 additions and 30 deletions
@@ -29,12 +29,16 @@ static const NSUInteger kTagOfRightSideButton = 999;
_topScrollView.showsVerticalScrollIndicator = NO; _topScrollView.showsVerticalScrollIndicator = NO;
_topScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth; _topScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
//底部的线 //底部的线
// UIView* lineView = [[UIView alloc] initWithFrame:CGRectMake(0, kHeightOfTopScrollView, 320, 3)];
// lineView.alpha = 0.3;
// [lineView setBackgroundColor:[UIColor blackColor]];
// [_topScrollView addSubview:lineView]
[_topScrollView addSubview:[ManagerUtil lineWithColor:[UIColor grayColor] withAlpha:0.3 withFrame:CGRectMake(0, kHeightOfTopScrollView, 320, 1)]]; [_topScrollView addSubview:[ManagerUtil lineWithColor:[UIColor grayColor] withAlpha:0.3 withFrame:CGRectMake(0, kHeightOfTopScrollView, 320, 1)]];
[self addSubview:_topScrollView]; [self addSubview:_topScrollView];
_userSelectedChannelID = 100; _userSelectedChannelID = 100;
//创建主滚动视图 //创建主滚动视图
_rootScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, kHeightOfTopScrollView, self.bounds.size.width, self.bounds.size.height - kHeightOfTopScrollView)]; _rootScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, kHeightOfTopScrollView+1, self.bounds.size.width, self.bounds.size.height - kHeightOfTopScrollView)];
_rootScrollView.delegate = self; _rootScrollView.delegate = self;
_rootScrollView.pagingEnabled = YES; _rootScrollView.pagingEnabled = YES;
_rootScrollView.userInteractionEnabled = YES; _rootScrollView.userInteractionEnabled = YES;
+1 -1
View File
@@ -42,7 +42,7 @@
} }
-(void)setLowestPriceWtihCount:(NSInteger)price -(void)setLowestPriceWtihCount:(NSInteger)price
{ {
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\" color:break; \">%ld</span>元起",price]; NSString* htmlStr = [NSString stringWithFormat:@"<span style=\" color:black; \">%ld</span>元起",price];
NSData *data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding]; NSData *data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentRight],DTDefaultTextAlignment,[UIColor grayColor],DTDefaultTextColor, nil]; NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentRight],DTDefaultTextAlignment,[UIColor grayColor],DTDefaultTextColor, nil];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil]; NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
+19 -13
View File
@@ -1,73 +1,79 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="QCf-WQ-E2P" customClass="FundListCell"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="109" id="QCf-WQ-E2P" customClass="FundListCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="108"/> <rect key="frame" x="0.0" y="0.0" width="320" height="109"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QCf-WQ-E2P" id="tWO-H0-dwT"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QCf-WQ-E2P" id="tWO-H0-dwT">
<rect key="frame" x="0.0" y="0.0" width="320" height="107"/> <rect key="frame" x="0.0" y="0.0" width="320" height="108"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="我有五个字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jTX-Fg-izQ"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="我有五个字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jTX-Fg-izQ">
<rect key="frame" x="10" y="14" width="140" height="21"/> <rect key="frame" x="10" y="14" width="140" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="小名字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iSf-Cf-gGc"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="小名字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iSf-Cf-gGc">
<rect key="frame" x="10" y="43" width="42" height="21"/> <rect key="frame" x="10" y="43" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Ly-0U-oSK"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4Ly-0U-oSK">
<rect key="frame" x="10" y="65" width="42" height="21"/> <rect key="frame" x="10" y="65" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.94664779970000001" green="0.21506300749999999" blue="0.1431705727" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.94664779970000001" green="0.21506300749999999" blue="0.1431705727" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="已经跑了30000米" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O3F-FR-wcE"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="已经跑了30000米" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="O3F-FR-wcE">
<rect key="frame" x="143" y="13" width="120" height="21"/> <rect key="frame" x="143" y="13" width="120" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="万分收益" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vsv-fO-QlW"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="万分收益" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vsv-fO-QlW">
<rect key="frame" x="143" y="43" width="90" height="21"/> <rect key="frame" x="143" y="43" width="90" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="icb-Rm-6zW"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="icb-Rm-6zW">
<rect key="frame" x="143" y="65" width="90" height="21"/> <rect key="frame" x="143" y="65" width="90" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="fund_cell_label_bg_blue.png" translatesAutoresizingMaskIntoConstraints="NO" id="0hb-Ff-rGB"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="fund_cell_label_bg_blue.png" id="0hb-Ff-rGB">
<rect key="frame" x="283" y="14" width="30" height="30"/> <rect key="frame" x="283" y="14" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="D4z-2i-gXI" customClass="DTAttributedLabel"> <view contentMode="scaleToFill" id="D4z-2i-gXI" customClass="DTAttributedLabel">
<rect key="frame" x="238" y="47" width="67" height="14"/> <rect key="frame" x="238" y="47" width="67" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view> </view>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YEu-dt-BBV" customClass="DTAttributedLabel"> <view contentMode="scaleToFill" id="YEu-dt-BBV" customClass="DTAttributedLabel">
<rect key="frame" x="238" y="69" width="67" height="14"/> <rect key="frame" x="238" y="69" width="67" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view> </view>
<view alpha="0.29999999999999999" contentMode="scaleToFill" id="rlA-Zw-HRE">
<rect key="frame" x="0.0" y="106" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</view>
</subviews> </subviews>
</tableViewCellContentView> </tableViewCellContentView>
<connections> <connections>
@@ -28,12 +28,22 @@
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
#pragma mark MJRefreshDelegate
-(void)headerRereshing
{
_count = 15;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[self headerEndRefreshing];
});
}
#pragma mark UITableViewDelegate #pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1; return 1;
} }
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 10; return _count;
} }
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
@@ -11,9 +11,12 @@
@interface ListViewController : UIViewController<UITableViewDelegate, UITableViewDataSource> @interface ListViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>
{ {
__weak UITableView* _tableView; __weak UITableView* _tableView;
NSInteger _count;
} }
@property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (assign, nonatomic)NSInteger count;
- (void)headerRereshing; - (void)headerRereshing;
- (void)footerRereshing; - (void)footerRereshing;
- (void)headerBeginRefreshing;
- (void)headerEndRefreshing;
@end @end
@@ -50,7 +50,6 @@
- (void)footerRereshing - (void)footerRereshing
{ {
// 2.2秒后刷新表格UI // 2.2秒后刷新表格UI
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格 // 刷新表格
@@ -60,6 +59,14 @@
[self.tableView footerEndRefreshing]; [self.tableView footerEndRefreshing];
}); });
} }
- (void)headerBeginRefreshing
{
[self.tableView headerBeginRefreshing];
}
-(void)headerEndRefreshing
{
[self.tableView headerEndRefreshing];
}
#pragma mark UITableViewDelegate #pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1; return 1;
@@ -10,7 +10,8 @@
#import "AdjustableUILable.h" #import "AdjustableUILable.h"
#import "LoanListCell.h" #import "LoanListCell.h"
@interface LoanListViewController () @interface LoanListViewController ()
{
}
@end @end
@implementation LoanListViewController @implementation LoanListViewController
@@ -28,14 +29,24 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
[self headerBeginRefreshing];
}
#pragma mark MJRefreshDelegate
-(void)headerRereshing
{
_count = 10;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[self headerEndRefreshing];
});
} }
#pragma mark UITableViewDelegate #pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1; return 1;
} }
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 10; return _count;
} }
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
@@ -7,7 +7,7 @@
// //
#import "OtherListViewController.h" #import "OtherListViewController.h"
#import "FundListCell.h"
@interface OtherListViewController () @interface OtherListViewController ()
@end @end
@@ -22,13 +22,50 @@
} }
return self; return self;
} }
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
#pragma mark MJRefreshDelegate
-(void)headerRereshing
{
_count = 6;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
[self headerEndRefreshing];
});
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return _count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 108.0;
return height;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *loanListCell = @"LoanListCell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:loanListCell];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:loanListCell];
NSArray *LoanListCellObjects = [[NSBundle mainBundle] loadNibNamed:@"FundListCell" owner:self options:nil];
cell = [LoanListCellObjects objectAtIndex:0];
}
[((FundListCell*)cell).totalLabel setText:@"已经有6783234人"];
return cell;
}
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
{ {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
@@ -11,6 +11,14 @@
#import "FundListViewController.h" #import "FundListViewController.h"
#import "OtherListViewController.h" #import "OtherListViewController.h"
@interface ProductListViewController () @interface ProductListViewController ()
{
LoanListViewController* _loanListViewController;
FundListViewController* _fundListViewController;
OtherListViewController* _otherListViewController;
NSInteger _nowSelectTab; //当前选择的界面。
}
@end @end
@@ -21,6 +29,13 @@
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) { if (self) {
// Custom initialization // Custom initialization
_loanListViewController = [[LoanListViewController alloc] initWithNibName:@"ListViewController" bundle:nil];
_loanListViewController.title = @"列表1";
_fundListViewController = [[FundListViewController alloc] initWithNibName:@"ListViewController" bundle:nil];
_fundListViewController.title = @"列表2";
_otherListViewController = [[OtherListViewController alloc] initWithNibName:@"ListViewController" bundle:nil];
_otherListViewController.title = @"列表3";
_nowSelectTab = 0;
} }
return self; return self;
} }
@@ -30,6 +45,8 @@
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view from its nib. // Do any additional setup after loading the view from its nib.
[ManagerUtil SetSubViewExternNone:self]; [ManagerUtil SetSubViewExternNone:self];
//右边按钮。
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(rightBarBtnClick:)]];
self.slideSwitchView.tabItemNormalColor = [QCSlideSwitchView colorFromHexRGB:@"868686"]; self.slideSwitchView.tabItemNormalColor = [QCSlideSwitchView colorFromHexRGB:@"868686"];
self.slideSwitchView.tabItemSelectedColor = [QCSlideSwitchView colorFromHexRGB:@"bb0b15"]; self.slideSwitchView.tabItemSelectedColor = [QCSlideSwitchView colorFromHexRGB:@"bb0b15"];
@@ -37,8 +54,27 @@
stretchableImageWithLeftCapWidth:59.0f topCapHeight:0.0f]; stretchableImageWithLeftCapWidth:59.0f topCapHeight:0.0f];
[self.navigationItem setTitle:@"第二页"]; [self.navigationItem setTitle:@"第二页"];
[self.slideSwitchView buildUI]; [self.slideSwitchView buildUI];
} }
#pragma mark method
-(void)rightBarBtnClick:(id)sender
{
switch (_nowSelectTab) {
case 0:
[_loanListViewController headerBeginRefreshing];
break;
case 1:
[_fundListViewController headerBeginRefreshing];
break;
case 2:
[_otherListViewController headerBeginRefreshing];
break;
default:
break;
}
}
#pragma mark - 滑动tab视图代理方法 #pragma mark - 滑动tab视图代理方法
@@ -55,21 +91,18 @@
switch (number) { switch (number) {
case 0: case 0:
{ {
viewController = [[LoanListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; viewController = _loanListViewController;
viewController.title = @"列表1";
} }
break; break;
case 1: case 1:
{ {
viewController = [[FundListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; viewController = _fundListViewController;
viewController.title = @"列表2";
} }
break; break;
case 2: case 2:
{ {
viewController = [[OtherListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; viewController = _otherListViewController;
viewController.title = @"列表3";
} }
break; break;
@@ -84,6 +117,27 @@
- (void)slideSwitchView:(QCSlideSwitchView *)view didselectTab:(NSUInteger)number - (void)slideSwitchView:(QCSlideSwitchView *)view didselectTab:(NSUInteger)number
{ {
DLog(@"%ld",number); DLog(@"%ld",number);
_nowSelectTab = number;
switch (number) {
case 0:
if (_loanListViewController.count <= 0) {
[_loanListViewController headerBeginRefreshing];
}
break;
case 1:
if (_fundListViewController.count <= 0) {
[_fundListViewController headerBeginRefreshing];
}
break;
case 2:
if (_otherListViewController.count <= 0) {
[_otherListViewController headerBeginRefreshing];
}
break;
default:
break;
}
} }