23

정오의 데이트 for iOS 코드 정리

  • Upload
    -

  • View
    125

  • Download
    0

Embed Size (px)

Citation preview

#pragma mark #import

ASIFormDataRequest *req = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"url"]]; [req setPostValue:user.name forKey:@“name”]; [req setPostValue:user.country forKey:@“country”]; [req setDelegate:self]; [req setDidFailSelector:@selector(handleError:)]; [req setDidFinishSelector:@selector(handleSuccess:)]; [req startAsynchronous];

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; [manager POST:@"url" parameters:user.dictionaryValue progress:nil success:^(NSURLSessionDataTask *task, id responseObject) { [self handleSuccess:responseObject]; } failure:^(NSURLSessionDataTask *task, NSError *error) { [self handleError:error]; }];

NDNetwork

UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10);

[superview addConstraints:@[ //view1 constraints [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeTop multiplier:1.0 constant:padding.top], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeLeft multiplier:1.0 constant:padding.left], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-padding.bottom], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeRight multiplier:1 constant:-padding.right], ]];

UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10); [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(superview).with.insets(padding); }];