添加一些接口

This commit is contained in:
2014-09-03 21:38:26 +08:00
parent d23c2b2d02
commit 2a2a6a7681
29 changed files with 508 additions and 209 deletions
+4
View File
@@ -133,6 +133,7 @@
A9C053FE19AD706C002331A5 /* ToolBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C053FD19AD706C002331A5 /* ToolBarView.m */; };
A9C0540519ADBCB2002331A5 /* FundProductInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C0540319ADBCB2002331A5 /* FundProductInfoViewController.m */; };
A9C0540619ADBCB2002331A5 /* FundProductInfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C0540419ADBCB2002331A5 /* FundProductInfoViewController.xib */; };
A9C2E4E519B6A0C900C659B3 /* icon_email@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9C2E4E419B6A0C900C659B3 /* icon_email@2x.png */; };
A9C69442199BB7B100B2CECE /* icon_person_take_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9C69441199BB7B100B2CECE /* icon_person_take_image@2x.png */; };
A9C69446199BBEB200B2CECE /* MyTotalProfitCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */; };
A9C69448199BC1F500B2CECE /* gray_select_arrow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9C69447199BC1F500B2CECE /* gray_select_arrow@2x.png */; };
@@ -362,6 +363,7 @@
A9C0540219ADBCB2002331A5 /* FundProductInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FundProductInfoViewController.h; sourceTree = "<group>"; };
A9C0540319ADBCB2002331A5 /* FundProductInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FundProductInfoViewController.m; sourceTree = "<group>"; };
A9C0540419ADBCB2002331A5 /* FundProductInfoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FundProductInfoViewController.xib; sourceTree = "<group>"; };
A9C2E4E419B6A0C900C659B3 /* icon_email@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_email@2x.png"; sourceTree = "<group>"; };
A9C69441199BB7B100B2CECE /* icon_person_take_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_person_take_image@2x.png"; sourceTree = "<group>"; };
A9C69444199BBEB200B2CECE /* MyTotalProfitCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyTotalProfitCellView.h; sourceTree = "<group>"; };
A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTotalProfitCellView.m; sourceTree = "<group>"; };
@@ -703,6 +705,7 @@
A9AF6C4D19949CAD0076C0EE /* Resource */ = {
isa = PBXGroup;
children = (
A9C2E4E419B6A0C900C659B3 /* icon_email@2x.png */,
A97F9D1C19B5931C0073E7E6 /* register_button_s@2x.png */,
A97F9D1D19B5931C0073E7E6 /* register_button@2x.png */,
A97F9D1819B592FD0073E7E6 /* login_button_s@2x.png */,
@@ -966,6 +969,7 @@
A988A902199A755300EB10AA /* FundListCell.xib in Resources */,
A9AF6C6919949CD30076C0EE /* icon_dock_session@2x.png in Resources */,
A9AF6C5C19949CD30076C0EE /* icon_dock_forum_actived@2x.png in Resources */,
A9C2E4E519B6A0C900C659B3 /* icon_email@2x.png in Resources */,
A97F9D1E19B5931C0073E7E6 /* register_button_s@2x.png in Resources */,
A9EC95BE19B54FEC00681678 /* textField_bg@2x.png in Resources */,
A9F1E18819ACB64D00B6A441 /* DTCoreTextTableViewCell.xib in Resources */,
@@ -45,4 +45,24 @@ typedef void (^FailedBlock) (NSError *error);
* @return MKNetworkOperation
*/
-(MKNetworkOperation*)loginWithPhone:(NSString*)phoneNum withPassWord:(NSString*)password withCompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock;
/**
* 获取列表
*
* @param completionBlock 请求完成
* @param failedBlock 请求失败
* @param type 类型
* @param pageNum 页数
* @return MKNetworkOperation
*/
-(MKNetworkOperation*)productListForType:(NSString*)type withPageNum:(NSInteger)pageNum withCompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock;
/**
* 获取个人信息
*
* @param completionBlock 请求完成
* @param failedBlock 请求失败
*
* @return MKNetworkOperation
*/
-(MKNetworkOperation*)getAccountInfoWithcompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock;
@end
@@ -31,12 +31,15 @@
}else{
dic = [[NSMutableDictionary alloc] init];
}
// [dic setObject:@"1408971073.153750" forKey:@"_"];
// [dic setObject:@"211d9ede2548c40e5d18e47358835b16" forKey:@"sign"];
// [dic setObject:@"MD5" forKey:@"sign_t"];
// [dic setObject:@"f241caa3534d751598871852a2f5205f4927fcf8" forKey:@"token"];
// [dic setObject:@"2.5.0" forKey:@"ver"];
// [dic setObject:@"IOS" forKey:@"vjson"];
NSDate* timeDate = [NSDate dateWithTimeIntervalSinceNow:0];
NSTimeInterval timeInterval =[timeDate timeIntervalSince1970]*1000;
NSString *timeString = [NSString stringWithFormat:@"%f", timeInterval];//转为字符型
[dic setObject:timeString forKey:@"_"];
[dic setObject:@"211d9ede2548c40e5d18e47358835b16" forKey:@"sign"];
[dic setObject:@"MD5" forKey:@"sign_t"];
[dic setObject:@"15e6c60bbdfa5d62dc7baab09cca5d19d1f32d11" forKey:@"token"];
[dic setObject:@"2.5.0" forKey:@"ver"];
[dic setObject:@"IOS" forKey:@"vjson"];
return [self operationWithPath:path params:dic httpMethod:@"GET" ssl:YES];
@@ -49,6 +52,15 @@
}else{
dic = [[NSMutableDictionary alloc] init];
}
NSDate* timeDate = [NSDate dateWithTimeIntervalSinceNow:0];
NSTimeInterval timeInterval =[timeDate timeIntervalSince1970]*1000;
NSString *timeString = [NSString stringWithFormat:@"%f", timeInterval];//转为字符型
[dic setObject:timeString forKey:@"_"];
[dic setObject:@"211d9ede2548c40e5d18e47358835b16" forKey:@"sign"];
[dic setObject:@"MD5" forKey:@"sign_t"];
[dic setObject:@"15e6c60bbdfa5d62dc7baab09cca5d19d1f32d11" forKey:@"token"];
[dic setObject:@"2.5.0" forKey:@"ver"];
[dic setObject:@"IOS" forKey:@"vjson"];
return [self operationWithPath:path params:dic httpMethod:@"POST" ssl:YES];
}
-(MKNetworkOperation*)getBannerInfoWithcompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock
@@ -102,4 +114,38 @@
return op;
}
-(MKNetworkOperation*)productListForType:(NSString *)type withPageNum:(NSInteger)pageNum withCompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock
{
NSDictionary* dic = [NSDictionary dictionaryWithObjectsAndKeys:type, @"type",[NSNumber numberWithInteger:pageNum],@"pageNum", nil];
MKNetworkOperation* op = [self postWithPath:@"productListForType.do" params:dic];
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
completionBlock(completedOperation.responseJSON);
} errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
DLog(@"%@", error);
failedBlock(error);
}];
[self enqueueOperation:op forceReload:YES];
return op;
}
-(MKNetworkOperation*)getAccountInfoWithcompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock
{
NSDictionary* dic = [NSDictionary dictionaryWithObjectsAndKeys:[ManagerUser shareInstance].userId, @"userId",[ManagerUser shareInstance].token,@"token", nil];
MKNetworkOperation* op = [self postWithPath:@"accountIndex4.do" params:dic];
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
completionBlock(completedOperation.responseJSON);
} errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
DLog(@"%@", error);
failedBlock(error);
}];
[self enqueueOperation:op forceReload:YES];
return op;
}
@end
+4
View File
@@ -11,7 +11,11 @@
@interface ManagerUser : NSObject
{
BOOL _isLogin;
NSString* _userId;
NSString* _token;
}
@property(nonatomic, assign)BOOL isLogin;
@property(nonatomic, strong)NSString* userId;
@property(nonatomic, strong)NSString* token;
+(ManagerUser*)shareInstance;
@end
+6
View File
@@ -41,4 +41,10 @@
+(UIImage*) buttonImageFromColor:(UIColor *)color withFrame:(CGRect)frame;
+(UIViewController *)getCurrentRootViewController;
/**
* 手机号码验证
*/
+(BOOL) isValidateMobile:(NSString *)mobile;
@end
+9
View File
@@ -138,4 +138,13 @@
}
/*手机号码验证 MODIFIED BY HELENSONG*/
+(BOOL) isValidateMobile:(NSString *)mobile
{
//手机号以13, 15,18开头,八个 \d 数字字符
NSString *phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex];
return [phoneTest evaluateWithObject:mobile];
}
@end
+1 -1
View File
@@ -29,6 +29,6 @@
-(void)setType:(NSString*)type;
-(void)setInfo:(NSString*)info;
-(void)setSecurityDesc:(NSString*)securityDesc;
-(void)setTime:(NSInteger)month withStartBuy:(NSInteger)money;
-(void)setTime:(NSString*)time withStartBuy:(NSInteger)money;
@end
+7 -4
View File
@@ -73,7 +73,7 @@
progressPercent = percent;
[_percentView setProgress:percent duration:1.0];
//中间文字
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:40px; color:red; text-align:center; \">%d</span>%%",(int)percent*100];
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:40px; color:red; text-align:center; \">%d</span>%%",(int)(percent*100.0)];
NSData *data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentCenter],DTDefaultTextAlignment, nil];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
@@ -82,15 +82,18 @@
-(void)setExpect:(float)expect
{
//预期
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:11px;text-align:center; \">四个大字<span style=\"font-size:13px; color:red;\">%.2f%%</span></span>",expect];
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:11px;text-align:center; \">预期年化<span style=\"font-size:13px; color:red;\">%.2f%%</span></span>",expect];
NSData* data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString* percentString = [[NSAttributedString alloc] initWithHTMLData:data documentAttributes:NULL];
_expectLabel.attributedString = percentString;
}
-(void)setTime:(NSInteger)month withStartBuy:(NSInteger)money
-(void)setTime:(NSString*)time withStartBuy:(NSInteger)money
{
NSCharacterSet* nonDigits = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
time = [time stringByReplacingOccurrencesOfString:[time stringByTrimmingCharactersInSet:nonDigits] withString:[NSString stringWithFormat:@"<span style=\"font-size:13px; color:red;\">%@</span>",[time stringByTrimmingCharactersInSet:nonDigits]]];
//时间
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:11px;text-align:center; \">限<span style=\"font-size:13px; color:red;\">%d</span>个月<span style=\"font-size:13px; color:red;\">%d</span>起</span>",month,money];
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:11px;text-align:center; \">%@<span style=\"font-size:13px; color:red;\">%d</span>起</span>",time,money];
NSData* data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString* percentString = [[NSAttributedString alloc] initWithHTMLData:data documentAttributes:NULL];
_timeLabel.attributedString = percentString;
@@ -48,10 +48,11 @@
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" placeholderIntrinsicWidth="42" placeholderIntrinsicHeight="21" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1tT-kO-DcP">
<rect key="frame" x="0.0" y="9" width="42" height="21"/>
<rect key="frame" x="0.0" y="3" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<rect key="contentStretch" x="1" y="1" width="1" height="1"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
<size key="shadowOffset" width="0.0" height="0.0"/>
</label>
@@ -16,6 +16,7 @@
@property (weak, nonatomic) IBOutlet UILabel *numProfitLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UIImageView *typeImg;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet DTAttributedLabel *buyTypeDtLabel;
@property (weak, nonatomic) IBOutlet DTAttributedLabel *lowestPriceDtLabel;
@@ -23,4 +24,6 @@
-(void)setBuyTypeWithString:(NSString*)htmlStr;
-(void)setLowestPriceWtihCount:(NSInteger)price;
-(void)setInfoDic:(NSDictionary*)dic;
@end
+21 -1
View File
@@ -26,6 +26,8 @@
[self setBuyTypeWithString:@"<font color=\"green\">随</font>买随卖"];
[self setLowestPriceWtihCount:1000];
//旋转
_typeLabel.transform = CGAffineTransformMakeRotation( M_PI/4);
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
@@ -42,11 +44,29 @@
}
-(void)setLowestPriceWtihCount:(NSInteger)price
{
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\" color:black; \">%ld</span>元起",price];
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\" color:black; \">%d</span>元起",price];
NSData *data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentRight],DTDefaultTextAlignment,[UIColor grayColor],DTDefaultTextColor, nil];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
_lowestPriceDtLabel.attributedString = percentString;
}
-(void)setInfoDic:(NSDictionary *)dic
{
self.nameLabel.text = [dic objectForKey:@"jjmc"];
self.profitLabel.text = [NSString stringWithFormat:@"%@ + %@",[dic objectForKey:@"nhsy"],[dic objectForKey:@"fd"]];
self.totalLabel.text = [NSString stringWithFormat:@"已申购%@人",[dic objectForKey:@"ygrs"]];
self.priceLabel.text = [NSString stringWithFormat:@"%@元",[dic objectForKey:@"wfsy"]];
[self setLowestPriceWtihCount:[[dic objectForKey:@"startBuy"] integerValue]];
NSMutableString* timeStr = [[NSMutableString alloc] initWithString:[dic objectForKey:@"jjzq"]];
[timeStr insertString:@"</span>" atIndex:1];
[timeStr insertString:@"<span style=\" color:green;\">" atIndex:0];
[self setBuyTypeWithString:timeStr];
if ([[dic objectForKey:@"tip"] isKindOfClass:[NSString class]]) {
_typeImg.hidden = NO;
_typeLabel.text = [dic objectForKey:@"tip"];
}else{
_typeImg.hidden = YES;
}
}
@end
+20 -12
View File
@@ -1,7 +1,7 @@
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -13,28 +13,28 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="108"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<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"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" id="jTX-Fg-izQ">
<rect key="frame" x="10" y="14" width="125" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<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"/>
<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="56" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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="125" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.94664779970000001" green="0.21506300749999999" blue="0.1431705727" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="已申购0人" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="O3F-FR-wcE">
<rect key="frame" x="143" y="13" width="120" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@@ -44,14 +44,14 @@
<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"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.25115593110000001" green="0.25115593110000001" blue="0.25115593110000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="fund_cell_label_bg_blue.png" id="0hb-Ff-rGB">
@@ -74,6 +74,13 @@
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</view>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="热售" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="3HE-Th-552">
<rect key="frame" x="283" y="18" width="34" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
@@ -86,6 +93,7 @@
<outlet property="profitLabel" destination="4Ly-0U-oSK" id="5oL-KW-9GM"/>
<outlet property="totalLabel" destination="O3F-FR-wcE" id="HdC-Ik-vzk"/>
<outlet property="typeImg" destination="0hb-Ff-rGB" id="XI5-40-QzE"/>
<outlet property="typeLabel" destination="3HE-Th-552" id="tMz-Tx-g9T"/>
</connections>
</tableViewCell>
</objects>
@@ -9,6 +9,7 @@
#import "FundListViewController.h"
#import "FundListCell.h"
#import "FundProductInfoViewController.h"
#import "MJRefresh.h"
@interface FundListViewController ()
@end
@@ -30,21 +31,39 @@
// Do any additional setup after loading the view.
}
#pragma mark MJRefreshDelegate
-(void)headerRereshing
-(void)loadData
{
_count = 15;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
[daiDaiTongApi productListForType:@"HW" withPageNum:_pageNum withCompletionBlock:^(id jsonRes) {
if (_pageNum == 1) {
[_productInfoArray removeAllObjects];
[self.tableView addFooterWithTarget:self action:@selector(footerRereshing)];
}
if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
[_productInfoArray addObjectsFromArray:[jsonRes objectForKey:@"datas"]];
// 刷新表格
if ([[jsonRes objectForKey:@"totalPages"] integerValue] <= [[jsonRes objectForKey:@"pageNum"] integerValue]) {
[self.tableView removeFooter];
}
[self.tableView reloadData];
}else{
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
}
[self headerEndRefreshing];
});
[self footerEndRefreshing];
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:self.view label:@"网络出错" hidesAfter:1.0];
[self headerEndRefreshing];
[self footerEndRefreshing];
}];
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return _count;
return _productInfoArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
@@ -61,7 +80,7 @@
[tableView registerNib:nib forCellReuseIdentifier:loanListCell];
cell = (FundListCell *)[tableView dequeueReusableCellWithIdentifier:loanListCell];
}
cell.selectedBackgroundView = [ManagerUtil selectBackgroudViewWithFrame:CGRectMake(0, 0, 320, [self tableView:tableView heightForRowAtIndexPath:indexPath])];
[(FundListCell*)cell setInfoDic:[_productInfoArray objectAtIndex:indexPath.row]];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
@@ -11,16 +11,20 @@
@interface ListViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>
{
__weak UITableView* _tableView;
NSInteger _count;
NSInteger _pageNum;
NSMutableArray* _productInfoArray;
__weak UIViewController* _delegate; //保存创建的UIViewControll
}
@property (weak, nonatomic) UIViewController* delegate;
@property (weak, nonatomic) UINavigationController* listNavigationController;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (assign, nonatomic)NSInteger count;
@property (strong, nonatomic)NSMutableArray* productInfoArray;
@property (assign, nonatomic)NSInteger pageNum;
- (void)headerRereshing;
- (void)footerRereshing;
- (void)headerBeginRefreshing;
- (void)headerEndRefreshing;
- (void)footerEndRefreshing;
- (void)firstRefresh;
- (void)loadData;
@end
@@ -32,6 +32,7 @@
frame.size.height -= 88;
_tableView.frame = frame;
}
_productInfoArray = [[NSMutableArray alloc] init];
[_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
self.tableView.delegate = self;
self.tableView.dataSource = self;
@@ -39,32 +40,22 @@
self.tableView.allowsSelection = YES;
[self.tableView addHeaderWithTarget:self action:@selector(headerRereshing)];
[self.tableView addFooterWithTarget:self action:@selector(footerRereshing)];
_pageNum = 1;
}
#pragma mark MJRefreshDelegate
- (void)headerRereshing
{
// 2.2秒后刷新表格UI
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
// (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
[self.tableView headerEndRefreshing];
});
_pageNum = 1;
[self loadData];
}
- (void)footerRereshing
{
// 2.2秒后刷新表格UI
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
// (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
[self.tableView footerEndRefreshing];
});
_pageNum++;
[self loadData];
}
- (void)headerBeginRefreshing
{
@@ -74,15 +65,19 @@
{
[self.tableView headerEndRefreshing];
}
-(void)footerEndRefreshing
{
[self.tableView footerEndRefreshing];
}
-(void)firstRefresh
{
if (_count <= 0) {
if (_productInfoArray.count <= 0) {
[self headerBeginRefreshing];
}
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 30;
+2 -2
View File
@@ -18,7 +18,7 @@
@property (weak, nonatomic) IBOutlet DTAttributedLabel *timeDtLabel;
@property (weak, nonatomic) IBOutlet DTAttributedLabel *percentDtlabel;
@property (weak, nonatomic) IBOutlet MRCircularProgressView *percentView;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
-(void)setPercent:(NSInteger) percent;
-(void)setTimeWithString:(NSString*)htmlString;
-(void)setInfoDic:(NSDictionary *)dic;
@end
+33 -2
View File
@@ -40,10 +40,12 @@
_percentView.wrapperColor = [UIColor clearColor];
_percentView.progressColor = [UIColor redColor];
_percentDtlabel.backgroundColor = [UIColor clearColor];
//旋转
_typeLabel.transform = CGAffineTransformMakeRotation( M_PI/4);
}
-(void)setPercent:(NSInteger) percent
{
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:20px; color:red; text-align:center; \">%ld</span> %%",percent];
NSString* htmlStr = [NSString stringWithFormat:@"<span style=\"font-size:20px; color:red; text-align:center; \">%d</span> %%",percent];
NSData *data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentCenter],DTDefaultTextAlignment, nil];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
@@ -52,9 +54,38 @@
}
-(void)setTimeWithString:(NSString*)htmlString
{
NSData *data = [htmlString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentCenter],DTDefaultTextAlignment, nil];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentLeft],DTDefaultTextAlignment, nil];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
_timeDtLabel.attributedString = percentString;
}
-(void)setStartBuy:(NSInteger)price
{
_priceLabel.text = [NSString stringWithFormat:@"%d元起购",price];
}
-(void)setInfoDic:(NSDictionary *)dic
{
self.profitLabel.text = [dic objectForKey:@"nhsy"];
self.nameLabel.text = [dic objectForKey:@"jjmc"];
self.typeLabel.text = [dic objectForKey:@"tip"];
if ([[dic objectForKey:@"state"] isEqualToString:@"SALE"]) {
[self setPercent:[[dic objectForKey:@"percent"] floatValue]];
[self setStartBuy:[[dic objectForKey:@"startBuy"] integerValue]];
NSMutableString* timeStr = [[NSMutableString alloc] initWithString:[dic objectForKey:@"jjzq"]];
[timeStr insertString:@"</span>" atIndex:1];
[timeStr insertString:@"<span style=\" color:green;\">" atIndex:0];
[self setTimeWithString:timeStr];
}else if([[dic objectForKey:@"state"] isEqualToString:@"EFFECTED"]){
[self setTimeWithString:@"最近还款日"];
[_percentView setProgress:0 animated:NO];
NSString* htmlStr = @"&nbsp;&nbsp;还款中";
NSData *data = [htmlStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentLeft],DTDefaultTextAlignment, nil];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
_percentDtlabel.attributedString = percentString;
_priceLabel.text = [dic objectForKey:@"recRepayDate"];
}
}
@end
+16 -8
View File
@@ -1,7 +1,7 @@
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -13,15 +13,15 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="107"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="我的名字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Idi-qw-ohG">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="名字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Idi-qw-ohG">
<rect key="frame" x="16" y="16" width="188" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="小名字" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cYE-AW-FFh">
<rect key="frame" x="16" y="43" width="100" height="21"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="预期年化" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cYE-AW-FFh">
<rect key="frame" x="16" y="50" width="100" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.25115593112244894" green="0.25115593112244894" blue="0.25115593112244894" alpha="1" colorSpace="calibratedRGB"/>
@@ -35,11 +35,11 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" id="0L4-K9-Tyn" customClass="DTAttributedLabel">
<rect key="frame" x="105" y="44" width="110" height="21"/>
<rect key="frame" x="124" y="54" width="91" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100个超人" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gFc-RY-QUU">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="50元起购" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gFc-RY-QUU">
<rect key="frame" x="104" y="73" width="100" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@@ -63,7 +63,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
<view contentMode="scaleToFill" id="jKx-eQ-tZj" customClass="DTAttributedLabel">
<rect key="frame" x="12" y="23" width="46" height="34"/>
<rect key="frame" x="12" y="26" width="46" height="28"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
</subviews>
@@ -74,6 +74,13 @@
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
</view>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="新手标" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="J9N-s5-AIQ">
<rect key="frame" x="270" y="16" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
@@ -85,6 +92,7 @@
<outlet property="profitLabel" destination="gnS-Tv-BcD" id="fMT-gW-cxV"/>
<outlet property="timeDtLabel" destination="0L4-K9-Tyn" id="5dK-d7-zP9"/>
<outlet property="typeImg" destination="Abj-cs-h8U" id="j1s-z7-TLe"/>
<outlet property="typeLabel" destination="J9N-s5-AIQ" id="MQ3-dI-VqM"/>
</connections>
</tableViewCell>
</objects>
@@ -10,6 +10,7 @@
#import "AdjustableUILable.h"
#import "LoanListCell.h"
#import "WYDProductViewController.h"
#import "MJRefresh.h"
@interface LoanListViewController ()
{
}
@@ -34,21 +35,41 @@
}
#pragma mark MJRefreshDelegate
-(void)headerRereshing
-(void)loadData
{
_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];
});
DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
[daiDaiTongApi productListForType:@"RYT" withPageNum:_pageNum withCompletionBlock:^(id jsonRes) {
if (_pageNum == 1) {
[_productInfoArray removeAllObjects];
[self.tableView addFooterWithTarget:self action:@selector(footerRereshing)];
}
if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
[_productInfoArray addObjectsFromArray:[jsonRes objectForKey:@"datas"]];
// 刷新表格
if ([[jsonRes objectForKey:@"totalPages"] integerValue] <= [[jsonRes objectForKey:@"pageNum"] integerValue]) {
[self.tableView removeFooter];
}
[self.tableView reloadData];
}else{
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
}
[self headerEndRefreshing];
[self footerEndRefreshing];
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:self.view label:@"网络出错" hidesAfter:1.0];
[self headerEndRefreshing];
[self footerEndRefreshing];
}];
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return _count;
return _productInfoArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
@@ -58,19 +79,17 @@
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *loanListCell = @"LoanListCell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:loanListCell];
static NSString *CellIdentifier = @"LoanListCell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
UINib *nib = [UINib nibWithNibName:@"LoanListCell" bundle:nil];
[tableView registerNib:nib forCellReuseIdentifier:loanListCell];
cell = (LoanListCell *)[tableView dequeueReusableCellWithIdentifier:loanListCell];
[tableView registerNib:nib forCellReuseIdentifier:CellIdentifier];
cell = (LoanListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
}
[cell setSelectionStyle:UITableViewCellSelectionStyleDefault];
[(LoanListCell*)cell setPercent:40];
NSString* htmlStr = @"<span style=\"text-align:center; color:green;\">限</span>12个月";
[(LoanListCell*)cell setTimeWithString:htmlStr];
cell.selectedBackgroundView = [ManagerUtil selectBackgroudViewWithFrame:CGRectMake(0, 0, 320, [self tableView:tableView heightForRowAtIndexPath:indexPath])];
[(LoanListCell*)cell setInfoDic:[_productInfoArray objectAtIndex:indexPath.row]];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
@@ -9,8 +9,11 @@
#import "OtherListViewController.h"
#import "FundListCell.h"
#import "OtherProductInfoViewController.h"
#import "MJRefresh.h"
@interface OtherListViewController ()
{
NSMutableArray* _productInfoArray;
}
@end
@implementation OtherListViewController
@@ -27,24 +30,45 @@
{
[super viewDidLoad];
// Do any additional setup after loading the view.
_productInfoArray = [[NSMutableArray alloc] init];
}
#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(), ^{
DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
[daiDaiTongApi productListForType:@"HK" withPageNum:_pageNum withCompletionBlock:^(id jsonRes) {
if (_pageNum == 1) {
[_productInfoArray removeAllObjects];
[self.tableView addFooterWithTarget:self action:@selector(footerRereshing)];
}
if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
[_productInfoArray addObjectsFromArray: [jsonRes objectForKey:@"datas"]];
// 刷新表格
if ([[jsonRes objectForKey:@"totalPages"] integerValue] <= [[jsonRes objectForKey:@"pageNum"] integerValue]) {
[self.tableView removeFooter];
}
[self.tableView reloadData];
}else{
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
}
[self headerEndRefreshing];
});
[self footerEndRefreshing];
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:self.view label:@"网络出错" hidesAfter:1.0];
[self headerEndRefreshing];
[self footerEndRefreshing];
}];
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return _count;
return _productInfoArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
@@ -63,8 +87,9 @@
cell = (FundListCell *)[tableView dequeueReusableCellWithIdentifier:loanListCell];
}
[((FundListCell*)cell).totalLabel setText:@"已经有6783234人"];
cell.selectedBackgroundView = [ManagerUtil selectBackgroudViewWithFrame:CGRectMake(0, 0, 320, [self tableView:tableView heightForRowAtIndexPath:indexPath])];
[((FundListCell*)cell) setInfoDic:[_productInfoArray objectAtIndex:indexPath.row]];
return cell;
}
@@ -59,14 +59,16 @@
DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
[daiDaiTongApi loginWithPhone:_phoneNum withPassWord:_passwordTextField.text withCompletionBlock:^(id jsonRes) {
if ([[jsonRes objectForKey:@"succ"] integerValue] != 1) {
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
// [MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
}else{
}
[ManagerUser shareInstance].isLogin = YES;
[self.navigationController popToRootViewControllerAnimated:NO];
if ([self.delegate respondsToSelector:@selector(loginSuccess)]) {
[self.delegate loginSuccess];
}
} failedBlock:^(NSError *error) {
DLog(@"失败");
[MBProgressHUD errorHudWithView:nil label:@"网络出错" hidesAfter:1.0];
@@ -139,6 +139,9 @@
- (IBAction)sureBtnClick:(id)sender {
if (![ManagerUtil isValidateMobile:_phoneTextField.text]) {
[MBProgressHUD errorHudWithView:self.view label:@"请输入正确手机号" hidesAfter:1.0];
}else{
InputPassWordViewController* inputPassWordViewController = [[InputPassWordViewController alloc] init];
inputPassWordViewController.hidesBottomBarWhenPushed = YES;
inputPassWordViewController.delegate = self;
@@ -146,6 +149,8 @@
[self.navigationController pushViewController:inputPassWordViewController animated:YES];
}
}
#pragma mark InputPassWordViewControllerDelegate
-(void)loginSuccess
{
@@ -18,7 +18,7 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" placeholder="输入您的手机号" clearsOnBeginEditing="YES" minimumFontSize="14" clearButtonMode="always" id="SX2-5w-3mj">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" placeholder="输入您的手机号" minimumFontSize="14" clearButtonMode="always" id="SX2-5w-3mj">
<rect key="frame" x="10" y="84" width="300" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@@ -15,17 +15,6 @@
if (self) {
// Initialization code
self.backgroundColor = [UIColor clearColor];
}
return self;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
CGSize size = self.frame.size;
//总收益标签
@@ -84,6 +73,18 @@
[rightBtn setBackgroundImage:[ManagerUtil buttonImageFromColor:Touch_BackGroudColor withFrame:rightBtn.frame] forState:UIControlStateHighlighted];
[rightBtn addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:rightBtn];
}
return self;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
-(void)leftBtnClick:(id)sender
@@ -12,8 +12,8 @@
#import "HomeMainView.h"
@interface HomeViewController ()
{
HomeAdView* homeAdView;
HomeMainView* homeMainView;
HomeAdView* _homeAdView;
HomeMainView* _homeMainView;
}
@end
@@ -54,27 +54,38 @@
#pragma mark MJRefreshDelegate
- (void)headerRereshing
{
DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
//广告条
[daiDaiTongApi getBannerInfoWithcompletionBlock:^(id jsonRes) {
if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
NSMutableArray* bannerInfo = [jsonRes objectForKey:@"infos"];
[homeAdView setBannerInfo:bannerInfo];
[_homeAdView setBannerInfo:bannerInfo];
}
} failedBlock:^(NSError *error) {
DLog(@"失败");
[MBProgressHUD errorHudWithView:nil label:@"网络出错" hidesAfter:1.0];
}];
_homeMainView.hidden = YES;
[daiDaiTongApi getFundRecommendWithcompletionBlock:^(id jsonRes) {
if ([[jsonRes objectForKey:@"succ"] integerValue] != 1) {
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
}else{
_homeMainView.hidden = NO;
[_homeMainView setName:[jsonRes objectForKey:@"name"]];
[_homeMainView setpercent:[[jsonRes objectForKey:@"percent"] floatValue]/100.0];
[_homeMainView setExpect:[[jsonRes objectForKey:@"qrsy"] floatValue]];
[_homeMainView setType:[jsonRes objectForKey:@"tip"]];
[_homeMainView setInfo:[jsonRes objectForKey:@"activityDesc"]];
[_homeMainView setSecurityDesc:[jsonRes objectForKey:@"securityDesc"]];
[_homeMainView setTime:[jsonRes objectForKey:@"jjzq"] withStartBuy:[[jsonRes objectForKey:@"startBuy"] integerValue]];
}
[self.tableView reloadData];
[self.tableView headerEndRefreshing];
} failedBlock:^(NSError *error) {
DLog(@"失败");
[MBProgressHUD errorHudWithView:nil label:@"网络出错" hidesAfter:1.0];
[self.tableView headerEndRefreshing];
}];
}
@@ -123,19 +134,19 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
switch (indexPath.row) {
case 0:{
homeAdView = [[HomeAdView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 140)];
homeAdView.superViewController = self;
[cell addSubview:homeAdView];
_homeAdView = [[HomeAdView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 140)];
_homeAdView.superViewController = self;
[cell addSubview:_homeAdView];
}
break;
case 1:{
homeMainView = [HomeMainView instanceHomeMainView];
CGRect frame = homeMainView.frame;
_homeMainView = [HomeMainView instanceHomeMainView];
CGRect frame = _homeMainView.frame;
frame.origin.x = 20;
homeMainView.frame = frame;
[cell addSubview:homeMainView];
_homeMainView.frame = frame;
[cell addSubview:_homeMainView];
}
default:
break;
@@ -56,7 +56,9 @@
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[ManagerUser shareInstance].isLogin = NO;
[ManagerUser shareInstance].isLogin = YES;
[ManagerUser shareInstance].userId = @"8201408070536905";
[ManagerUser shareInstance].token = @"15e6c60bbdfa5d62dc7baab09cca5d19d1f32d11";
}
+98 -45
View File
@@ -12,7 +12,12 @@
#import "AccountInfoViewController.h"
#import "DailyIncomeViewController.h"
@interface MyViewController ()
{
NSDictionary* _myInfoDic;
MyTotalProfitCellView* _myTotalProfitCellView;
UILabel* _timeLabel;
UILabel* _profitLabel;
}
@end
@implementation MyViewController
@@ -22,6 +27,7 @@
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
_myInfoDic = nil;
}
return self;
}
@@ -34,17 +40,18 @@
[ManagerUtil SetSubViewExternNone:self];
//左边按钮
[self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"左边按钮" style:UIBarButtonItemStyleDone target:self action:@selector(leftBarBtnClick:)]];
[self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"帮助" style:UIBarButtonItemStyleDone target:self action:@selector(leftBarBtnClick:)]];
//右边按钮。
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(rightBarBtnClick:)]];
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_email"] style:UIBarButtonItemStyleDone target:self action:@selector(rightBarBtnClick:)]];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.allowsSelection = YES;
[_tableView addHeaderWithTarget:self action:@selector(headerRereshing)];
[self headerRereshing];
}
@@ -52,34 +59,33 @@
- (void)headerRereshing
{
// 2.2秒后刷新表格UI
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
// (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
[self.tableView headerEndRefreshing];
});
DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
[daiDaiTongApi getAccountInfoWithcompletionBlock:^(id jsonRes) {
if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
_myInfoDic = [NSDictionary dictionaryWithDictionary:jsonRes];
}
[_tableView reloadData];
[_tableView headerEndRefreshing];
} failedBlock:^(NSError *error) {
}];
}
- (void)footerRereshing
{
// 2.2秒后刷新表格UI
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// 刷新表格
[self.tableView reloadData];
// (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
[self.tableView footerEndRefreshing];
});
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if (_myInfoDic) {
return 5;
}
return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
@@ -114,33 +120,27 @@
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell* cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
NSString* cellIdentifier = [NSString stringWithFormat:@"cell%d%d",indexPath.section,indexPath.row];
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier];
switch (indexPath.section) {
case 0:
{
cell.textLabel.text = @"吴盛华";
cell.imageView.image = [UIImage imageNamed:@"icon_person_take_image"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text = @"13212312313";
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
}
break;
case 1:
{
cell.backgroundColor = [UIColor redColor];
UILabel* timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 25, 320, 30)];
timeLabel.textColor = [UIColor whiteColor];
timeLabel.font = Font_Black(15);
timeLabel.textAlignment = NSTextAlignmentCenter;
timeLabel.text = @"08月12日收益(元)";
[cell addSubview:timeLabel];
UILabel* profitLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 320, 100)];
profitLabel.textColor = [UIColor whiteColor];
profitLabel.font = Font_Black(50);
profitLabel.textAlignment = NSTextAlignmentCenter;
profitLabel.text = @"100.04";
_timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 25, 320, 30)];
_timeLabel.textColor = [UIColor whiteColor];
_timeLabel.font = Font_Black(15);
_timeLabel.textAlignment = NSTextAlignmentCenter;
[cell addSubview:_timeLabel];
_profitLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 320, 100)];
_profitLabel.textColor = [UIColor whiteColor];
_profitLabel.font = Font_Black(50);
_profitLabel.textAlignment = NSTextAlignmentCenter;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell addSubview:profitLabel];
[cell addSubview:_profitLabel];
}
break;
case 2:
@@ -151,11 +151,14 @@
MyTotalProfitCellView* myTotalProfitCellView = [[MyTotalProfitCellView alloc] initWithFrame:frmae];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell addSubview:myTotalProfitCellView];
myTotalProfitCellView.totalMoneyLabel.text = [_myInfoDic objectForKey:@"totalAmount"];
myTotalProfitCellView.profitMoneyLabel.text = [_myInfoDic objectForKey:@"totalProfit"];
}
break;
case 3:
{
cell.textLabel.text = @"我是超人";
cell.textLabel.text = @"交易记录";
cell.detailTextLabel.text = @"查看记录";
cell.textLabel.textColor = [UIColor grayColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
@@ -163,10 +166,61 @@
break;
case 4:
{
cell.textLabel.text = @"我是超人";
cell.textLabel.text = @"总积分";
cell.textLabel.textColor = [UIColor grayColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text = @"100";
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",[_myInfoDic objectForKey:@"point"]];
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
}
break;
default:
break;
}
}
switch (indexPath.section) {
case 0:
{
cell.textLabel.text = [[_myInfoDic objectForKey:@"info"] objectForKey:@"realShowName"];
cell.imageView.image = [UIImage imageNamed:@"icon_person_take_image"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text = [[_myInfoDic objectForKey:@"info"] objectForKey:@"cell"];
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
}
break;
case 1:
{
_timeLabel.text = [NSString stringWithFormat:@"%@收益(元)",[_myInfoDic objectForKey:@"profitShowDate"]];
_profitLabel.text = [_myInfoDic objectForKey:@"datePofit"];
}
break;
case 2:
{
CGRect frmae = cell.frame;
frmae.size.height = [self tableView:tableView heightForRowAtIndexPath:indexPath];
cell.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];
MyTotalProfitCellView* myTotalProfitCellView = [[MyTotalProfitCellView alloc] initWithFrame:frmae];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell addSubview:myTotalProfitCellView];
myTotalProfitCellView.totalMoneyLabel.text = [_myInfoDic objectForKey:@"totalAmount"];
myTotalProfitCellView.profitMoneyLabel.text = [_myInfoDic objectForKey:@"totalProfit"];
}
break;
case 3:
{
cell.textLabel.text = @"交易记录";
cell.detailTextLabel.text = @"查看记录";
cell.textLabel.textColor = [UIColor grayColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
}
break;
case 4:
{
cell.textLabel.text = @"总积分";
cell.textLabel.textColor = [UIColor grayColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@分",[_myInfoDic objectForKey:@"point"]];
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
}
break;
@@ -174,7 +228,6 @@
break;
}
// cell.selectedBackgroundView = [ManagerUtil selectBackgroudViewWithFrame:CGRectMake(0, -1, 320, [self tableView:tableView heightForRowAtIndexPath:indexPath]-2)];
return cell;
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB