Commit 18b81387 by houweibin

1,软键盘挡住优惠码输入框问题

2,去掉多余的线
3,其他调整
parent 70bc6c29
...@@ -101,6 +101,10 @@ ...@@ -101,6 +101,10 @@
C02986901F0F2663002EB25F /* KWMWishCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C029868E1F0F2663002EB25F /* KWMWishCell.xib */; }; C02986901F0F2663002EB25F /* KWMWishCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C029868E1F0F2663002EB25F /* KWMWishCell.xib */; };
C02C5A931FD54C7D00E32290 /* KWMRecommendView.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C5A901FD54C7C00E32290 /* KWMRecommendView.m */; }; C02C5A931FD54C7D00E32290 /* KWMRecommendView.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C5A901FD54C7C00E32290 /* KWMRecommendView.m */; };
C02C5A941FD54C7D00E32290 /* KWMRecommendView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C02C5A911FD54C7C00E32290 /* KWMRecommendView.xib */; }; C02C5A941FD54C7D00E32290 /* KWMRecommendView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C02C5A911FD54C7C00E32290 /* KWMRecommendView.xib */; };
C02C5A9E1FD6944500E32290 /* TPKeyboardAvoidingCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C5A971FD6944500E32290 /* TPKeyboardAvoidingCollectionView.m */; };
C02C5A9F1FD6944500E32290 /* TPKeyboardAvoidingScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C5A991FD6944500E32290 /* TPKeyboardAvoidingScrollView.m */; };
C02C5AA01FD6944500E32290 /* TPKeyboardAvoidingTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C5A9B1FD6944500E32290 /* TPKeyboardAvoidingTableView.m */; };
C02C5AA11FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C5A9D1FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.m */; };
C02C7D801E640D82008DC29C /* libWeChatSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C02C7D7B1E640D82008DC29C /* libWeChatSDK.a */; }; C02C7D801E640D82008DC29C /* libWeChatSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C02C7D7B1E640D82008DC29C /* libWeChatSDK.a */; };
C02C7D811E640D82008DC29C /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = C02C7D7C1E640D82008DC29C /* README.txt */; }; C02C7D811E640D82008DC29C /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = C02C7D7C1E640D82008DC29C /* README.txt */; };
C02C7D831E640FBF008DC29C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02C7D821E640FBF008DC29C /* SystemConfiguration.framework */; }; C02C7D831E640FBF008DC29C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02C7D821E640FBF008DC29C /* SystemConfiguration.framework */; };
...@@ -547,6 +551,14 @@ ...@@ -547,6 +551,14 @@
C02C5A901FD54C7C00E32290 /* KWMRecommendView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMRecommendView.m; sourceTree = "<group>"; }; C02C5A901FD54C7C00E32290 /* KWMRecommendView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMRecommendView.m; sourceTree = "<group>"; };
C02C5A911FD54C7C00E32290 /* KWMRecommendView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMRecommendView.xib; sourceTree = "<group>"; }; C02C5A911FD54C7C00E32290 /* KWMRecommendView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMRecommendView.xib; sourceTree = "<group>"; };
C02C5A921FD54C7D00E32290 /* KWMRecommendView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMRecommendView.h; sourceTree = "<group>"; }; C02C5A921FD54C7D00E32290 /* KWMRecommendView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMRecommendView.h; sourceTree = "<group>"; };
C02C5A961FD6944500E32290 /* TPKeyboardAvoidingCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPKeyboardAvoidingCollectionView.h; sourceTree = "<group>"; };
C02C5A971FD6944500E32290 /* TPKeyboardAvoidingCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPKeyboardAvoidingCollectionView.m; sourceTree = "<group>"; };
C02C5A981FD6944500E32290 /* TPKeyboardAvoidingScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPKeyboardAvoidingScrollView.h; sourceTree = "<group>"; };
C02C5A991FD6944500E32290 /* TPKeyboardAvoidingScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPKeyboardAvoidingScrollView.m; sourceTree = "<group>"; };
C02C5A9A1FD6944500E32290 /* TPKeyboardAvoidingTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPKeyboardAvoidingTableView.h; sourceTree = "<group>"; };
C02C5A9B1FD6944500E32290 /* TPKeyboardAvoidingTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPKeyboardAvoidingTableView.m; sourceTree = "<group>"; };
C02C5A9C1FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+TPKeyboardAvoidingAdditions.h"; sourceTree = "<group>"; };
C02C5A9D1FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+TPKeyboardAvoidingAdditions.m"; sourceTree = "<group>"; };
C02C7D7B1E640D82008DC29C /* libWeChatSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWeChatSDK.a; sourceTree = "<group>"; }; C02C7D7B1E640D82008DC29C /* libWeChatSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWeChatSDK.a; sourceTree = "<group>"; };
C02C7D7C1E640D82008DC29C /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; }; C02C7D7C1E640D82008DC29C /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
C02C7D7D1E640D82008DC29C /* WechatAuthSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WechatAuthSDK.h; sourceTree = "<group>"; }; C02C7D7D1E640D82008DC29C /* WechatAuthSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WechatAuthSDK.h; sourceTree = "<group>"; };
...@@ -1241,6 +1253,21 @@ ...@@ -1241,6 +1253,21 @@
path = Cell; path = Cell;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
C02C5A951FD6944500E32290 /* TPKeyboardAvoiding */ = {
isa = PBXGroup;
children = (
C02C5A961FD6944500E32290 /* TPKeyboardAvoidingCollectionView.h */,
C02C5A971FD6944500E32290 /* TPKeyboardAvoidingCollectionView.m */,
C02C5A981FD6944500E32290 /* TPKeyboardAvoidingScrollView.h */,
C02C5A991FD6944500E32290 /* TPKeyboardAvoidingScrollView.m */,
C02C5A9A1FD6944500E32290 /* TPKeyboardAvoidingTableView.h */,
C02C5A9B1FD6944500E32290 /* TPKeyboardAvoidingTableView.m */,
C02C5A9C1FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.h */,
C02C5A9D1FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.m */,
);
path = TPKeyboardAvoiding;
sourceTree = "<group>";
};
C02C7D7A1E640D82008DC29C /* WeChat */ = { C02C7D7A1E640D82008DC29C /* WeChat */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1509,6 +1536,7 @@ ...@@ -1509,6 +1536,7 @@
C034E6C51D6AECF9006EE129 /* View */ = { C034E6C51D6AECF9006EE129 /* View */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C02C5A951FD6944500E32290 /* TPKeyboardAvoiding */,
C0CCB3B51EEA520C00BC2FB8 /* FilterView */, C0CCB3B51EEA520C00BC2FB8 /* FilterView */,
C0DD53251EE55190002D1E0C /* Cell */, C0DD53251EE55190002D1E0C /* Cell */,
C0DD53261EE55190002D1E0C /* Loading */, C0DD53261EE55190002D1E0C /* Loading */,
...@@ -2684,6 +2712,7 @@ ...@@ -2684,6 +2712,7 @@
C034E8621D6B10A0006EE129 /* PBPGView.m in Sources */, C034E8621D6B10A0006EE129 /* PBPGView.m in Sources */,
C0243BC01EFBD5A10013CFA7 /* KWMRightProductCell.m in Sources */, C0243BC01EFBD5A10013CFA7 /* KWMRightProductCell.m in Sources */,
C02C7DB41E67B56D008DC29C /* KWMFilterHeaderView.m in Sources */, C02C7DB41E67B56D008DC29C /* KWMFilterHeaderView.m in Sources */,
C02C5A9E1FD6944500E32290 /* TPKeyboardAvoidingCollectionView.m in Sources */,
80ED0A371D93840A00B28DF2 /* DB_shopCart.xcdatamodeld in Sources */, 80ED0A371D93840A00B28DF2 /* DB_shopCart.xcdatamodeld in Sources */,
C0DD53391EE55190002D1E0C /* KWMSplashView.m in Sources */, C0DD53391EE55190002D1E0C /* KWMSplashView.m in Sources */,
80E844271D7FB0FF0042AED2 /* KWMRuleView.m in Sources */, 80E844271D7FB0FF0042AED2 /* KWMRuleView.m in Sources */,
...@@ -2704,6 +2733,7 @@ ...@@ -2704,6 +2733,7 @@
807AF4A51DC984950000A326 /* KWMCustomerResult.m in Sources */, 807AF4A51DC984950000A326 /* KWMCustomerResult.m in Sources */,
DA8B97801F58F816002FC38A /* SDImageCache+Resize.m in Sources */, DA8B97801F58F816002FC38A /* SDImageCache+Resize.m in Sources */,
C066650F1D7675FC00F02EF4 /* KWMAboutUsVC.m in Sources */, C066650F1D7675FC00F02EF4 /* KWMAboutUsVC.m in Sources */,
C02C5AA11FD6944500E32290 /* UIScrollView+TPKeyboardAvoidingAdditions.m in Sources */,
807AF4A31DC984950000A326 /* KWMBlogResult.m in Sources */, 807AF4A31DC984950000A326 /* KWMBlogResult.m in Sources */,
C0CC14081D7823B0007B5986 /* KWMSizeCell.m in Sources */, C0CC14081D7823B0007B5986 /* KWMSizeCell.m in Sources */,
C057C77D1F172D4C00B95034 /* KWMMidDetailView.m in Sources */, C057C77D1F172D4C00B95034 /* KWMMidDetailView.m in Sources */,
...@@ -2724,6 +2754,7 @@ ...@@ -2724,6 +2754,7 @@
C091EE331DDB1FC500A382B9 /* KWMAppVersion.m in Sources */, C091EE331DDB1FC500A382B9 /* KWMAppVersion.m in Sources */,
C0CC14041D7823B0007B5986 /* KWMDeleteView.m in Sources */, C0CC14041D7823B0007B5986 /* KWMDeleteView.m in Sources */,
C0028ECB1F0E2B3500744C14 /* KWMAdditionalListResult.m in Sources */, C0028ECB1F0E2B3500744C14 /* KWMAdditionalListResult.m in Sources */,
C02C5A9F1FD6944500E32290 /* TPKeyboardAvoidingScrollView.m in Sources */,
8091DFA11D6E878C0020519C /* KWMGuideVC.m in Sources */, 8091DFA11D6E878C0020519C /* KWMGuideVC.m in Sources */,
C034E84A1D6B10A0006EE129 /* UIImage+Color.m in Sources */, C034E84A1D6B10A0006EE129 /* UIImage+Color.m in Sources */,
801230F21DD30704008C7904 /* KWMSearchBrandsCell.m in Sources */, 801230F21DD30704008C7904 /* KWMSearchBrandsCell.m in Sources */,
...@@ -2777,6 +2808,7 @@ ...@@ -2777,6 +2808,7 @@
DA4E36951F1726B80007E4D0 /* UIViewController+HTTP.m in Sources */, DA4E36951F1726B80007E4D0 /* UIViewController+HTTP.m in Sources */,
807AF4A71DC984950000A326 /* KWMProducts.m in Sources */, 807AF4A71DC984950000A326 /* KWMProducts.m in Sources */,
C0F5868A1E24F820001248E2 /* KWMSelectedGoodsVC.m in Sources */, C0F5868A1E24F820001248E2 /* KWMSelectedGoodsVC.m in Sources */,
C02C5AA01FD6944500E32290 /* TPKeyboardAvoidingTableView.m in Sources */,
C034E8661D6B10A0006EE129 /* PhotoItemView.m in Sources */, C034E8661D6B10A0006EE129 /* PhotoItemView.m in Sources */,
9B166F511ED6DBCF003E9F03 /* KWMHttpUtil.m in Sources */, 9B166F511ED6DBCF003E9F03 /* KWMHttpUtil.m in Sources */,
C034E6D91D6AEF1B006EE129 /* KWMStringUtil.m in Sources */, C034E6D91D6AEF1B006EE129 /* KWMStringUtil.m in Sources */,
......
...@@ -277,7 +277,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -277,7 +277,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
} }
} }
if(isUseClientAuth){ if(isUseClientAuth){
[sessionManager.requestSerializer setValue:@"Basic YzJmNmZhZTk3NzQxZWE2ZGI0Y2FkN2FlOGY3MGZlZjM==" forHTTPHeaderField:@"Authorization"]; [sessionManager.requestSerializer setValue:Order_API_Auth forHTTPHeaderField:@"Authorization"];
} }
return sessionManager; return sessionManager;
} }
...@@ -1149,7 +1149,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -1149,7 +1149,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
} }
/** /**
* 清空愿望单 API * 获取所以订单 API
* @param customer_id 用户ID * @param customer_id 用户ID
* @param customer_email 用户邮箱 * @param customer_email 用户邮箱
* @param shop 店铺名(cemarose-test.myshopify.com) * @param shop 店铺名(cemarose-test.myshopify.com)
...@@ -1158,7 +1158,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -1158,7 +1158,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
success:(void(^)(NSURLSessionDataTask *task,KWMOrderListResult *result))success success:(void(^)(NSURLSessionDataTask *task,KWMOrderListResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{ failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [NSString stringWithFormat:@"https://%@/customer/orders/custom-orders",WishList_API_DOMAIN]; NSString *apiPath = [NSString stringWithFormat:@"https://%@/customer/orders/custom-orders",WishList_API_DOMAIN];
// apiPath = @"https://peter.tofnews.com/customer/orders/custom-orders"; // apiPath = @"https://test.cemarose.com/customer/orders/custom-orders";
return [self startSessionTask:KWMHTTPMethodGET return [self startSessionTask:KWMHTTPMethodGET
apiPath:apiPath apiPath:apiPath
parameters:parameters parameters:parameters
......
...@@ -225,8 +225,8 @@ ...@@ -225,8 +225,8 @@
}; };
[self.api getOrderList:parameters success:^(NSURLSessionDataTask *task, KWMOrderListResult *result) { [self.api getOrderList:parameters success:^(NSURLSessionDataTask *task, KWMOrderListResult *result) {
[weakSelf hideLoading]; [weakSelf hideLoading];
if(!result.code || result.code.integerValue != 1000){ if(!result || !result.code || result.code.integerValue != 1000){
if(result.message){ if(result && result.message){
[weakSelf showToast:result.message]; [weakSelf showToast:result.message];
} }
return; return;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#import "KWMPayTypeVC.h" #import "KWMPayTypeVC.h"
#import "KWMBeforePayData.h" #import "KWMBeforePayData.h"
@interface KWMBeforePayVC : KWMBaseVC<KWMGiftCardDelegate,KWMSelectAddressDelegate,KWMSelectShippingRateDelegate,UITextFieldDelegate> @interface KWMBeforePayVC : KWMBaseVC<KWMGiftCardDelegate,KWMSelectAddressDelegate,KWMSelectShippingRateDelegate>
//沒有默認地址時,高度為37,有地址時,高度為90 //沒有默認地址時,高度為37,有地址時,高度為90
@property(nonatomic,weak) IBOutlet NSLayoutConstraint *vAddressHeight; @property(nonatomic,weak) IBOutlet NSLayoutConstraint *vAddressHeight;
...@@ -50,10 +50,6 @@ ...@@ -50,10 +50,6 @@
@property (weak, nonatomic) IBOutlet UIButton *btnDiscountEdit; @property (weak, nonatomic) IBOutlet UIButton *btnDiscountEdit;
@property (weak, nonatomic) IBOutlet UITextField *tfDiscount; @property (weak, nonatomic) IBOutlet UITextField *tfDiscount;
@property (weak, nonatomic) IBOutlet UIButton *btnBg;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *marginTopContent;
//价格 //价格
@property (weak, nonatomic) IBOutlet UILabel *lbTotalPrice; @property (weak, nonatomic) IBOutlet UILabel *lbTotalPrice;
......
...@@ -482,24 +482,6 @@ ...@@ -482,24 +482,6 @@
[self startCheckout]; [self startCheckout];
} }
#pragma mark - UITextFieldDelegate
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
self.marginTopContent.constant = 22 - 200;
[UIView animateWithDuration:0.5 animations:^{
[self.view layoutIfNeeded];
}];
return YES;
}
//键盘弹出
-(void)keyboardWillHide:(NSNotification *)notification{
self.marginTopContent.constant = 22;
[UIView animateWithDuration:0.5 animations:^{
[self.view layoutIfNeeded];
}];
}
-(void)startCheckout{ -(void)startCheckout{
if(self.checkout == nil){ if(self.checkout == nil){
[self showToast:@"未成功初始化订单"]; [self showToast:@"未成功初始化订单"];
......
//
// TPKeyboardAvoidingCollectionView.h
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel & The CocoaBots. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIScrollView+TPKeyboardAvoidingAdditions.h"
@interface TPKeyboardAvoidingCollectionView : UICollectionView <UITextFieldDelegate, UITextViewDelegate>
- (BOOL)focusNextTextField;
- (void)scrollToActiveTextField;
@end
//
// TPKeyboardAvoidingCollectionView.m
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel & The CocoaBots. All rights reserved.
//
#import "TPKeyboardAvoidingCollectionView.h"
@interface TPKeyboardAvoidingCollectionView () <UITextFieldDelegate, UITextViewDelegate>
@end
@implementation TPKeyboardAvoidingCollectionView
#pragma mark - Setup/Teardown
- (void)setup {
if ( [self hasAutomaticKeyboardAvoidingBehaviour] ) return;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextViewTextDidBeginEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextFieldTextDidBeginEditingNotification object:nil];
}
-(id)initWithFrame:(CGRect)frame {
if ( !(self = [super initWithFrame:frame]) ) return nil;
[self setup];
return self;
}
- (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
if ( !(self = [super initWithFrame:frame collectionViewLayout:layout]) ) return nil;
[self setup];
return self;
}
-(void)awakeFromNib {
[super awakeFromNib];
[self setup];
}
-(void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
#if !__has_feature(objc_arc)
[super dealloc];
#endif
}
-(BOOL)hasAutomaticKeyboardAvoidingBehaviour {
if ( [[[UIDevice currentDevice] systemVersion] integerValue] >= 9
&& [self.delegate isKindOfClass:[UICollectionViewController class]] ) {
// Theory: It looks like iOS 9's collection views automatically avoid the keyboard. As usual
// Apple have totally failed to document this anywhere, so this is just a guess.
return YES;
}
return NO;
}
-(void)setFrame:(CGRect)frame {
[super setFrame:frame];
[self TPKeyboardAvoiding_updateContentInset];
}
-(void)setContentSize:(CGSize)contentSize {
if (CGSizeEqualToSize(contentSize, self.contentSize)) {
// Prevent triggering contentSize when it's already the same that
// cause weird infinte scrolling and locking bug
return;
}
[super setContentSize:contentSize];
[self TPKeyboardAvoiding_updateContentInset];
}
- (BOOL)focusNextTextField {
return [self TPKeyboardAvoiding_focusNextTextField];
}
- (void)scrollToActiveTextField {
return [self TPKeyboardAvoiding_scrollToActiveTextField];
}
#pragma mark - Responders, events
-(void)willMoveToSuperview:(UIView *)newSuperview {
[super willMoveToSuperview:newSuperview];
if ( !newSuperview ) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) object:self];
}
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[[self TPKeyboardAvoiding_findFirstResponderBeneathView:self] resignFirstResponder];
[super touchesEnded:touches withEvent:event];
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
if ( ![self focusNextTextField] ) {
[textField resignFirstResponder];
}
return YES;
}
-(void)layoutSubviews {
[super layoutSubviews];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) object:self];
[self performSelector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) withObject:self afterDelay:0.1];
}
@end
//
// TPKeyboardAvoidingScrollView.h
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIScrollView+TPKeyboardAvoidingAdditions.h"
@interface TPKeyboardAvoidingScrollView : UIScrollView <UITextFieldDelegate, UITextViewDelegate>
- (void)contentSizeToFit;
- (BOOL)focusNextTextField;
- (void)scrollToActiveTextField;
@end
//
// TPKeyboardAvoidingScrollView.m
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel. All rights reserved.
//
#import "TPKeyboardAvoidingScrollView.h"
@interface TPKeyboardAvoidingScrollView () <UITextFieldDelegate, UITextViewDelegate>
@end
@implementation TPKeyboardAvoidingScrollView
#pragma mark - Setup/Teardown
- (void)setup {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextViewTextDidBeginEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextFieldTextDidBeginEditingNotification object:nil];
}
-(id)initWithFrame:(CGRect)frame {
if ( !(self = [super initWithFrame:frame]) ) return nil;
[self setup];
return self;
}
-(void)awakeFromNib {
[super awakeFromNib];
[self setup];
}
-(void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
#if !__has_feature(objc_arc)
[super dealloc];
#endif
}
-(void)setFrame:(CGRect)frame {
[super setFrame:frame];
[self TPKeyboardAvoiding_updateContentInset];
}
-(void)setContentSize:(CGSize)contentSize {
[super setContentSize:contentSize];
[self TPKeyboardAvoiding_updateFromContentSizeChange];
}
- (void)contentSizeToFit {
self.contentSize = [self TPKeyboardAvoiding_calculatedContentSizeFromSubviewFrames];
}
- (BOOL)focusNextTextField {
return [self TPKeyboardAvoiding_focusNextTextField];
}
- (void)scrollToActiveTextField {
return [self TPKeyboardAvoiding_scrollToActiveTextField];
}
#pragma mark - Responders, events
-(void)willMoveToSuperview:(UIView *)newSuperview {
[super willMoveToSuperview:newSuperview];
if ( !newSuperview ) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) object:self];
}
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[[self TPKeyboardAvoiding_findFirstResponderBeneathView:self] resignFirstResponder];
[super touchesEnded:touches withEvent:event];
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
if ( ![self focusNextTextField] ) {
[textField resignFirstResponder];
}
return YES;
}
-(void)layoutSubviews {
[super layoutSubviews];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) object:self];
[self performSelector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) withObject:self afterDelay:0.1];
}
@end
//
// TPKeyboardAvoidingTableView.h
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIScrollView+TPKeyboardAvoidingAdditions.h"
@interface TPKeyboardAvoidingTableView : UITableView <UITextFieldDelegate, UITextViewDelegate>
- (BOOL)focusNextTextField;
- (void)scrollToActiveTextField;
@end
//
// TPKeyboardAvoidingTableView.m
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel. All rights reserved.
//
#import "TPKeyboardAvoidingTableView.h"
@interface TPKeyboardAvoidingTableView () <UITextFieldDelegate, UITextViewDelegate>
@end
@implementation TPKeyboardAvoidingTableView
#pragma mark - Setup/Teardown
- (void)setup {
if ( [self hasAutomaticKeyboardAvoidingBehaviour] ) return;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextViewTextDidBeginEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextFieldTextDidBeginEditingNotification object:nil];
}
-(id)initWithFrame:(CGRect)frame {
if ( !(self = [super initWithFrame:frame]) ) return nil;
[self setup];
return self;
}
-(id)initWithFrame:(CGRect)frame style:(UITableViewStyle)withStyle {
if ( !(self = [super initWithFrame:frame style:withStyle]) ) return nil;
[self setup];
return self;
}
-(void)awakeFromNib {
[super awakeFromNib];
[self setup];
}
-(void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
#if !__has_feature(objc_arc)
[super dealloc];
#endif
}
-(BOOL)hasAutomaticKeyboardAvoidingBehaviour {
if ( [self.delegate isKindOfClass:[UITableViewController class]] ) {
// Theory: Apps built using the iOS 8.3 SDK (probably: older SDKs not tested) seem to handle keyboard
// avoiding automatically with UITableViewController. This doesn't seem to be documented anywhere
// by Apple, so results obtained only empirically.
return YES;
}
return NO;
}
-(void)setFrame:(CGRect)frame {
[super setFrame:frame];
if ( [self hasAutomaticKeyboardAvoidingBehaviour] ) return;
[self TPKeyboardAvoiding_updateContentInset];
}
-(void)setContentSize:(CGSize)contentSize {
if ( [self hasAutomaticKeyboardAvoidingBehaviour] ) {
[super setContentSize:contentSize];
return;
}
if (CGSizeEqualToSize(contentSize, self.contentSize)) {
// Prevent triggering contentSize when it's already the same
// this cause table view to scroll to top on contentInset changes
return;
}
[super setContentSize:contentSize];
[self TPKeyboardAvoiding_updateContentInset];
}
- (BOOL)focusNextTextField {
return [self TPKeyboardAvoiding_focusNextTextField];
}
- (void)scrollToActiveTextField {
return [self TPKeyboardAvoiding_scrollToActiveTextField];
}
#pragma mark - Responders, events
-(void)willMoveToSuperview:(UIView *)newSuperview {
[super willMoveToSuperview:newSuperview];
if ( !newSuperview ) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) object:self];
}
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[[self TPKeyboardAvoiding_findFirstResponderBeneathView:self] resignFirstResponder];
[super touchesEnded:touches withEvent:event];
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
if ( ![self focusNextTextField] ) {
[textField resignFirstResponder];
}
return YES;
}
-(void)layoutSubviews {
[super layoutSubviews];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) object:self];
[self performSelector:@selector(TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:) withObject:self afterDelay:0.1];
}
@end
//
// UIScrollView+TPKeyboardAvoidingAdditions.h
// TPKeyboardAvoiding
//
// Created by Michael Tyson on 30/09/2013.
// Copyright 2015 A Tasty Pixel. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIScrollView (TPKeyboardAvoidingAdditions)
- (BOOL)TPKeyboardAvoiding_focusNextTextField;
- (void)TPKeyboardAvoiding_scrollToActiveTextField;
- (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification;
- (void)TPKeyboardAvoiding_keyboardWillHide:(NSNotification*)notification;
- (void)TPKeyboardAvoiding_updateContentInset;
- (void)TPKeyboardAvoiding_updateFromContentSizeChange;
- (void)TPKeyboardAvoiding_assignTextDelegateForViewsBeneathView:(UIView*)view;
- (UIView*)TPKeyboardAvoiding_findFirstResponderBeneathView:(UIView*)view;
-(CGSize)TPKeyboardAvoiding_calculatedContentSizeFromSubviewFrames;
@end
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#define NO_MORE_DATA @"------ 沒有啦 ------" #define NO_MORE_DATA @"------ 沒有啦 ------"
#define Order_API_Auth @"Basic YzJmNmZhZTk3NzQxZWE2ZGI0Y2FkN2FlOGY3MGZlZjM=="
//正式的微信key //正式的微信key
#define WechatAppKey @"wx355a497b2a2dd6d5" #define WechatAppKey @"wx355a497b2a2dd6d5"
......
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