Commit 923729f1 authored by Sandy's avatar Sandy

商品详情页面bug fix

parent 38c92318
......@@ -8,11 +8,11 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CommodityDetailBottomView"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="CommodityDetailBottomView">
<rect key="frame" x="0.0" y="0.0" width="324" height="142"/>
<rect key="frame" x="0.0" y="0.0" width="324" height="80"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleAspectFit" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aoN-Hz-W7F">
<rect key="frame" x="65" y="83" width="34" height="52"/>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aoN-Hz-W7F">
<rect key="frame" x="65" y="8" width="34" height="52"/>
<constraints>
<constraint firstAttribute="width" constant="34" id="MEe-J1-sOo"/>
<constraint firstAttribute="height" constant="52" id="MsZ-Sb-kDE"/>
......@@ -27,8 +27,8 @@
</mask>
</variation>
</button>
<button opaque="NO" contentMode="scaleAspectFit" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Aw9-Qe-Nwo">
<rect key="frame" x="109" y="83" width="195" height="52"/>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Aw9-Qe-Nwo">
<rect key="frame" x="115" y="8" width="193" height="52"/>
<constraints>
<constraint firstAttribute="width" constant="195" id="Hke-9r-Lpe"/>
<constraint firstAttribute="height" constant="52" id="mTJ-fG-h3H"/>
......@@ -40,15 +40,15 @@
</mask>
</variation>
</button>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dUa-UD-hsS">
<rect key="frame" x="19" y="18" width="271" height="39"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dUa-UD-hsS">
<rect key="frame" x="0.0" y="0.0" width="324" height="2"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="0.16272836538461538" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="1cl-wt-sFJ"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleAspectFit" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3sW-LB-Orb">
<rect key="frame" x="19" y="82" width="33" height="52"/>
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3sW-LB-Orb">
<rect key="frame" x="16" y="8" width="33" height="52"/>
<constraints>
<constraint firstAttribute="height" constant="52" id="4vd-ba-xPJ"/>
<constraint firstAttribute="width" constant="33" id="QYT-a0-cxz"/>
......@@ -116,7 +116,7 @@
<outlet property="buttonShare" destination="Aw9-Qe-Nwo" id="koi-RC-MzR"/>
<outlet property="buttonShop" destination="aoN-Hz-W7F" id="Vni-HC-cHY"/>
</connections>
<point key="canvasLocation" x="430" y="246"/>
<point key="canvasLocation" x="332" y="214"/>
</view>
</objects>
<resources>
......
......@@ -7,8 +7,8 @@
//
#import <UIKit/UIKit.h>
typedef void (^topBlock)(void);
@interface CommodityDetailTopView : UIView
@property (nonatomic, copy) topBlock bacBlock;
@property (nonatomic, copy) topBlock homeBlock;
@property (weak, nonatomic) IBOutlet UIButton *buttonBack;
@property (weak, nonatomic) IBOutlet UIButton *buttonHome;
@end
......@@ -11,13 +11,6 @@
@implementation CommodityDetailTopView
- (IBAction)backActiion:(UIButton *)sender {
self.bacBlock();
}
- (IBAction)homeAction:(id)sender {
self.homeBlock();
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
......@@ -18,16 +18,10 @@
<constraint firstAttribute="height" constant="44" id="xgs-oj-Y1x"/>
</constraints>
<state key="normal" image="commodityDetailBack"/>
<connections>
<action selector="backActiion:" destination="-1" eventType="touchUpInside" id="Rcx-bi-ED3"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gWc-ej-xNw">
<rect key="frame" x="260" y="36" width="44" height="44"/>
<state key="normal" image="commodityDetailHome"/>
<connections>
<action selector="homeAction:" destination="-1" eventType="touchUpInside" id="2HN-As-jcv"/>
</connections>
</button>
</subviews>
<constraints>
......@@ -39,6 +33,10 @@
<constraint firstAttribute="trailing" secondItem="gWc-ej-xNw" secondAttribute="trailing" constant="16" id="wvz-3B-6lR"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="buttonBack" destination="Tkk-cJ-NcJ" id="9il-f8-93p"/>
<outlet property="buttonHome" destination="gWc-ej-xNw" id="tyD-go-V6V"/>
</connections>
<point key="canvasLocation" x="318" y="89"/>
</view>
</objects>
......
......@@ -10,7 +10,7 @@
#import "CommodityDetailBottomView.h"
#import "CommodityDetailTopView.h"
#import "CommodityMutipleSelectBottomView.h"
@interface CommodityDetailViewController ()
@interface CommodityDetailViewController ()<UIWebViewDelegate>
@property (nonatomic, strong) CommodityDetailBottomView *bottomView;
@property (nonatomic, strong) CommodityDetailTopView *topView;
@end
......@@ -26,27 +26,28 @@
self.view.backgroundColor = kBacroundColor;
[self setUpWebView];
[self.view addSubview:self.topView];
WS(weakSelf)
self.topView.bacBlock = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
self.topView.homeBlock = ^{
CLog(@"home");
};
[self.view addSubview:self.bottomView];
self.bottomView.userInteractionEnabled = NO;
//添加点击事件
kButtonAddAction(self.bottomView.buttonShop, addCommodity)
kButtonAddAction(self.bottomView.buttonShare, shareAction)
kButtonAddAction(self.topView.buttonBack, backAction)
kButtonAddAction(self.topView.buttonHome, homeAction)
}
[self.view addSubview:self.bottomView];
[self.bottomView.buttonShop addTarget:self action:@selector(addCommodity) forControlEvents:UIControlEventTouchUpInside];
[self.bottomView.buttonShare addTarget:self action:@selector(shareAction) forControlEvents:UIControlEventTouchUpInside];
- (void)backAction {
[self.navigationController popViewControllerAnimated:YES];
}
// Do any additional setup after loading the view.
- (void)homeAction {
CLog(@"home");
[self.navigationController popToRootViewControllerAnimated:YES];
}
- (void)addCommodity {
CLog(@"添加商品");
UserInfo *info = [UserInfo shareInstance];
......@@ -92,10 +93,10 @@
- (void)setUpWebView {
UserInfo *userInfo = [UserInfo shareInstance];
NSString *urlStr = [NSString stringWithFormat:@"%@Wap/detail/shop_id/%@/id/%@/hastbar/1/.html", userInfo.webShopBaseUrl, userInfo.shop.uuid, self.model.uuid];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight - 67)];
NSURL *url = [NSURL URLWithString:urlStr];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
webView.delegate = self;
[self.view addSubview:webView];
webView.userInteractionEnabled = YES;
......@@ -113,6 +114,15 @@
[self.navigationController setNavigationBarHidden:YES];
}
#pragma mark =========== webView delegate ===========
- (void)webViewDidStartLoad:(UIWebView *)webView {
[MBProgressHUD showHUDAddedTo:webView animated:YES];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
self.bottomView.userInteractionEnabled = YES;
[MBProgressHUD hideHUDForView:webView];
}
#pragma mark =========== lazy loading ===========
- (CommodityDetailBottomView *)bottomView {
......
......@@ -52,6 +52,8 @@
#define IsDictObject(Object) [(Object) isKindOfClass:[NSDictionary class]]
#define IsErrorObject(Object) ![(Object) isKindOfClass:[NSError class]]
#define kSysWhite [UIColor whiteColor]
#define kButtonAddAction(button, buttonAction) [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
#pragma mark =========== end ===========
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment