我的商铺项目总结
来源:互联网 发布:没有性格特点知乎 编辑:程序博客网 时间:2024/05/16 01:01
1.
#pragma mark - 键盘通知的处理
//添加键盘通知响应
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(handleKeyboardWillShow:)name:UIKeyboardWillShowNotificationobject:nil];
[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(handleKeyboardWillHide:)name:UIKeyboardWillHideNotificationobject:nil];
}
//移除通知观察者
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[NSNotificationCenterdefaultCenter]removeObserver:self];
}
- (void)handleKeyboardWillShow:(NSNotification *)paramNotification{
//获取键盘通知的属性
NSDictionary *userInfo = [paramNotificationuserInfo];
NSNumber *animationCurveObject = [userInfovalueForKey:UIKeyboardAnimationCurveUserInfoKey];
NSNumber *animationDurationObject = [userInfovalueForKey:UIKeyboardAnimationDurationUserInfoKey];
NSValue *keyboardEndRectObject = [userInfovalueForKey:UIKeyboardFrameEndUserInfoKey];
NSUInteger animationCurve = [animationCurveObjectintegerValue];
double animationDuration = [animationDurationObjectdoubleValue];
CGRect keyboardEndRect = [keyboardEndRectObjectCGRectValue];
//开始一个动画,修改popView的位置
[UIViewbeginAnimations:@"changePopViewFrame"context:nil];
[UIView setAnimationDuration:animationDuration];
[UIView setAnimationCurve:(UIViewAnimationCurve)animationCurve];
//获得两个frame之间的交集
UIView *popView = [self.view.superviewviewWithTag:PopViewTag];
CGRect intersectionOfKeyboardRectAndPopViewRect =CGRectIntersection(popView.frame, keyboardEndRect);
CGFloat intersectionHeight = intersectionOfKeyboardRectAndPopViewRect.size.height;
//NSLog(@"%f",intersectionHeight);
//只移动intersectionHeight只是让view与键盘之间没有缝隙
rect = popView.frame;
CGFloat moveHeight = [AppHelperratelyCaculateHeight:MoveYOffset];
popView.frame = CGRectMake(rect.origin.x,rect.origin.y - intersectionHeight - moveHeight,rect.size.width,rect.size.height);
[UIViewcommitAnimations];
}
2.
#pragma mark - 判断字符串为空和只为空格
+ (BOOL)isBlankString:(NSString *)testString{
if (testString == nil) {
return YES;
}
if (testString == NULL) {
return YES;
}
if ([testString isKindOfClass:[NSNull class]]) {
return YES;
}
if ([testString length] == 0) {
return YES;
}
return NO;
}
-(UIImage*) OriginImage:(UIImage *)image scaleToSize:(CGSize)size
{
UIGraphicsBeginImageContext(size); //size 为CGSize类型,即你所需要的图片尺寸
[image drawInRect:CGRectMake(0,0, size.width, size.height)];
UIImage* scaledImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage; //返回的就是已经改变的图片
}
4.//修改我的店铺密码
#define ModifyMyShopPassWord(shopMobile,shopOldPassword,shopNewPassword) [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"><soap12:Body><ModifyPassword xmlns=\"http://123.233.116.125/\"><mobile>%@</mobile><oldPassWord>%@</oldPassWord><newPassWord>%@</newPassWord></ModifyPassword></soap12:Body></soap12:Envelope>",shopMobile,shopOldPassword,shopNewPassword]
- (void)modifyMyShopPasswordWithOldPassword:(NSString *)oldPassword andNewPassword:(NSString *)newPassword andPhoneNumber:(NSString *)phoneNumber{
@autoreleasepool {
if ([[NetworkMonitorsharedTheNetworkMonitor]isTheNetworkAvailable] ==NO) {
[self stop];
return;
}
//------------------------
Merchant *theMerchant = [CoreDataHelpersharedCoreDataHelper].nowMerchant;
NSManagedObjectID *objectID = theMerchant.objectID;
if (objectID) {
theMerchant = (Merchant*)[operationContextobjectWithID:objectID];
}
else{
[self stop];
return;
}
NSLog(@"theMerchant.phone = %@",phoneNumber);
//------------------------
//根据原密码 ,手机号,新密码 修改密码
NSString *soapMessage = ModifyMyShopPassWord(phoneNumber, oldPassword, newPassword);
NSURL *url = [NSURLURLWithString:kShopServiceURL];
NSMutableURLRequest *request = [NSMutableURLRequestrequestWithURL:url];
[request setHTTPMethod:@"POST"];
[request addValue:@"application/soap+xml; charset = utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue: [NSStringstringWithFormat:@"%@",@([soapMessagelength])]forHTTPHeaderField:@"Content-Length"];
[request addValue:@"ModifyPassword" forHTTPHeaderField:@"SOAPAction"];
[request setHTTPBody: [soapMessagedataUsingEncoding:NSUTF8StringEncoding]];
//--------------------------
[request setTimeoutInterval:kTimeoutInterval];
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[NSURLConnectionsendAsynchronousRequest:request
queue:[NSOperationQueuenew]
completionHandler:^(NSURLResponse *response,NSData *data, NSError *connectionError) {
if (connectionError || data.length <1) {
FShowObjectInfo(@" connectionError", connectionError);
FShowObjectInfo(@" data ", data);
[self stop];
return;
}
NSString *string = [[NSStringalloc]initWithData: data encoding:NSUTF8StringEncoding];
if (string) {
NSString *resultStr = [AppHelpergetValueForKey:@"ModifyPasswordResult"
fromXmlString:string];
//NSLog(@"resultStr = %@",resultStr);
dispatch_queue_t mainQueue =dispatch_get_main_queue();
if ([resultStrintegerValue] == 0) {
//成功
dispatch_sync(mainQueue, ^{
[self.observerdoSomethingOfDelegateObjectWithBool:YES];
});
}else{
dispatch_sync(mainQueue, ^{
[self.observerdoSomethingOfDelegateObjectWithBool:NO];
});
}
}
}];
}
}
- 我的商铺项目总结
- 我的项目总结
- 我的项目总结
- 我的项目总结
- 我的项目流程总结
- 我的一个项目总结
- 我的一个项目总结
- 项目总结---我的体会
- 我的软件项目需求分析总结
- 我的项目流程总结V2.0
- 我的项目流程总结V2.0
- 我参与的一个项目总结
- 我所做过的项目总结
- 我的手游项目总结
- 我的串口控制交付项目总结
- 我做的第一个项目的项目总结
- 总结一下 我接触的(学习的)那些项目
- 我参与的一个项目的继续总结:牢骚篇
- Windows Sockets 错误码及出错原因
- /bin/sh^M: bad interpreter: No such file or directory
- poj 3259 Wormholes[ bellman_ford 判负环]
- Valgrind
- 基于JQuery easyUI combobox实现了一个类似google、百度输入框的提示
- 我的商铺项目总结
- 每天一点数据库之-----Day 6 数据分组与数据分页
- 字符串匹配算法总结 (分析及Java实现)
- 高斯模糊算法
- Delphi 导出、导入Excel的一个快速方法
- [LeetCode]Delete Digits
- 算法精解十一(C语言版)
- SpringMvc定时器任务
- apue学习第二十四天——高级I/O、生产者消费者问题、socket(提纲)