//四舍五入//得到倒序//比较字符串//拦截时间,实现超时锁屏//判断是否越狱//配置PodFile//Storyboard中跳转操作//处理不可逆的push界面操作

//处理不可逆的push界面操作

VerifyRealNameViewController *verifyRealNameCtrl = [VerifyRealNameViewController viewControllerWithStoryBoard:@"Registe" identify:@"VerifyRealNameViewController"];

UIViewController *topCtrl = [self.navigationController topViewController];

NSMutableArray *ctrlArray = [[self.navigationController viewControllers] mutableCopy];

[ctrlArray removeLastObject];

[ctrlArray addObject:verifyRealNameCtrl];

[topCtrl.navigationController setViewControllers:ctrlArray];

//Storyboard中跳转操作

[self performSegueWithIdentifier:@"pushToThird" sender:self];

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

if ([segue.identifier isEqualToString:@"pushToThird"]) {

NSLog(@"THIRD");

}

else if ([segue.identifier isEqualToString:@"pushToFour"]) {

}

}

//配置PodFile

workspace 'test1'

platform :ios,'7.0'

target :Framework,:exclusive => true do

xcodeproj 'Framework/Framework.xcodeproj'

pod "AFNetworking", "~> 2.0"

pod 'MBProgressHUD', '~> 0.9.1'

end

target :testOne,:exclusive => true do

xcodeproj 'testOne.xcodeproj'

pod "AFNetworking", "~> 2.0"

pod 'OHHTTPStubs', '~> 4.3.0'

end

//判断是否越狱

static __inline__ __attribute__((__always_inline__)) BOOL jailbreak_util_is_jailbreak()

{

#if TARGET_IPHONE_SIMULATOR

return NO;

#else

static BOOL isJailbreak;

static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

isJailbreak = checkEnv()

//|| checkStatInject()

|| jailbreak_util_checkCydiaByStat()

|| jailbreak_util_support_system()

|| jailbreak_util_jailbreak_apps_exits()

|| jailbreak_util_support_url();

if (isJailbreak) {

[[APIManager sharedInstance] setAPICommonParameterWithName:@"isRooted" value:@"1"];

}

});

return isJailbreak;

#endif

}

//拦截时间,实现超时锁屏

- (void)sendEvent:(UIEvent *)event

{

if (event.type == UIEventTypeTouches) {

//取消执行函数——cancelPreviousPerformRequestsWithTarget

[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(onLongTimeNoTouchTimeout) object:nil];

if ([[event.allTouches anyObject] phase] == UITouchPhaseEnded) {

[self performSelector:@selector(onLongTimeNoTouchTimeout) withObject:nil afterDelay:g_longtime_no_touch_interval];

}

}

[super sendEvent:event];

}

//比较字符串

+ (BOOL)areStringEqualWithStr1:(NSString *)str1 str2:(NSString *)str2

{

if (str1==nil && str2==nil) {

return YES;

}

//类型不匹配,返回NO

if(![str1 isKindOfClass:[NSString class]] || ![str2 isKindOfClass:[NSString class]])

{

return NO;

}

if (str2!=nil) {

return [str1 isEqualToString:str2];

}

return NO;

}

//得到倒序

self.showFunds = [[self.showFunds reverseObjectEnumerator] allObjects];

//四舍五入

NSDecimalNumberHandler *handler = [[NSDecimalNumberHandler alloc]initWithRoundingMode:NSRoundPlain

scale:2

raiseOnExactness:NO

raiseOnOverflow:NO

raiseOnUnderflow:NO

raiseOnDivideByZero:NO];

dayIncome = [dayIncome decimalNumberByRoundingAccordingToBehavior:handler];

//设计字段技巧

typedef NS_ENUM(NSInteger, EnumFundSortField) {

/**

*    日涨跌

*/

EnumSortFieldDay = 0,

/**

*    近一月

*/

EnumSortFieldLast1Month,

/**

*    近1年

*/

EnumSortFieldLast1Year,

/**

*    今年

*/

EnumSortFieldCurrentYear,

/**

*    近一周

*/

EnumSortFieldLast1Weak,

/**

*    近3月

*/

EnumSortFieldLast3Month,

/**

*    成立以来

*/

EnumSortFieldFromEstablish,

/**

*    可选排序字段数目(不含单位净值)

*/

EnumSortFieldCount,

/**

*    单位净值

*/

EnumSortFieldNetValue,

/**

*    万分收益,仅用于货币/短期理财类

*/

EnumSortFieldIncomeUnit,

/**

*    七日年化,仅用于货币/短期理财类

*/

EnumSortFieldIncomeRatio

};

- (NSString *)getTitleWithEnumSortField:(EnumFundSortField)field

{

//如果当前仅选择了货币/短期理财类基金,则使用七日年化

if (field == EnumSortFieldDay && [self.fundType.isCurrenty boolValue]) {

return @"七日年化";

}

if (field < EnumSortFieldCount) {

return [g_fundSortFieldTitles[field - EnumSortFieldDay] copy];

}

return nil;

}

上一篇:C#如何获取快捷方式指向的目标文件


下一篇:mysql字符串操作相关函数用法总结