Skip to content

Instantly share code, notes, and snippets.

@gliubc
gliubc / .m
Created August 14, 2019 02:33
NSString *language = [[NSLocale preferredLanguages] firstObject];
NSString *languageCode = [language componentsSeparatedByString:@"-"].firstObject;
@gliubc
gliubc / .m
Last active October 20, 2020 03:08
NSString *url = @"/shopUpdate/aliPay/aliAppPay.do";
NSMutableDictionary *params = [NSMutableDictionary new];
params[@"total_amount"] = self.amount;
params[@"out_trade_no"] = self.orderNo;
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[SVProgressHUD show];
- (void)chatWithQQ:(NSString *)qq {
if (!qq.length) {
[SVProgressHUD showInfoWithStatus:@"QQ号码不存在"];
return;
}
if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]]) {
[SVProgressHUD showInfoWithStatus:@"您尚未安装QQ应用"];
return;
}
NSString *url = [NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web", qq];
//
// StudyHelpDetailVC.m
// LNMobileProject
//
// Created by Liu Cheng on 2019/7/10.
//
#import "StudyHelpDetailVC.h"
#import <WebKit/WebKit.h>
/// 导航返回时跳过的控制器数目
@property (assign, nonatomic) NSInteger navSkipCount;
- (BOOL)navigationShouldPopOnBackButton {
NSArray *navStack = self.navigationController.viewControllers;
[self.navigationController popToViewController:navStack[navStack.count - 2 - self.navSkipCount] animated:YES];
return NO;
}
#import "TTTAttributedLabel.h"
@interface StudyServiceVC () <TTTAttributedLabelDelegate>
@property (weak, nonatomic) IBOutlet TTTAttributedLabel *labelTip;
self.labelTip.linkAttributes = @{NSForegroundColorAttributeName:HEXCOLOR(0x22CB91), NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle)};
self.labelTip.enabledTextCheckingTypes = NSTextCheckingTypeLink;
self.labelTip.delegate = self;
self.labelTip.text = @"如果服务地址有误,请通过意见反馈发给我们,方便我们修改!";
@gliubc
gliubc / .m
Last active May 28, 2019 02:16
@interface PostLoanVC () <HXPhotoViewDelegate>
@property (weak, nonatomic) IBOutlet HXPhotoView *photoView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintPhotoViewHeight;
self.photoView.addImageName = @"detail_button_add";
self.photoView.lineCount = 5;
self.photoView.delegate = self;
self.photoView.manager.configuration.restoreNavigationBar = YES;
self.photoView.manager.configuration.albumShowMode = HXPhotoAlbumShowModePopup;
@gliubc
gliubc / .m
Last active July 12, 2019 09:02
#import "HXPhotoPicker.h"
@property (strong, nonatomic) HXPhotoManager *manager;
- (HXPhotoManager *)manager {
if (!_manager) {
_manager = [[HXPhotoManager alloc] initWithType:HXPhotoManagerSelectedTypePhoto];
_manager.configuration.restoreNavigationBar = YES;
_manager.configuration.albumShowMode = HXPhotoAlbumShowModePopup;
@gliubc
gliubc / .m
Last active July 22, 2019 04:29
#import "WZLBadgeImport.h"
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.messageButtonItem.badgeCenterOffset = CGPointMake(-10, 5);
self.messageButtonItem.badgeFont = [UIFont systemFontOfSize:12];
self.messageButtonItem.badgeBgColor = HEXCOLOR(0xFF7159);
self.messageButtonItem.badgeTextColor = HEXCOLOR(0xFFFFFF);
[self.messageButtonItem showBadgeWithStyle:WBadgeStyleNumber value:333 animationType:WBadgeAnimTypeNone];
@gliubc
gliubc / .m
Last active July 22, 2019 00:36
#import <Reachability.h>
@property (strong, nonatomic) Reachability *internetReachableFoo;
// Checks if we have an internet connection or not
- (void)testInternetConnection
{
self.internetReachableFoo = [Reachability reachabilityWithHostname:@"www.bing.com"];
// Internet is reachable