This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CGSize size = [info[@"entry"] boundingRectWithSize:CGSizeMake(260, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)htmlExpectToPDF{ | |
| UIViewPrintFormatter *viewPrintFormatter = [self.webView viewPrintFormatter]; | |
| viewPrintFormatter.startPage = 0; | |
| UIPrintPageRenderer *pageRender = [[UIPrintPageRenderer alloc] init]; | |
| [pageRender addPrintFormatter:viewPrintFormatter startingAtPageAtIndex:0]; | |
| CGRect page; | |
| page.origin.x=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)testAirPrint{ | |
| UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; | |
| pic.delegate = self; | |
| UIPrintInfo *printInfo = [UIPrintInfo printInfo]; | |
| printInfo.outputType = UIPrintInfoOutputGeneral; | |
| printInfo.jobName = self.webView.URL.scheme; | |
| pic.printInfo = printInfo; | |
| UIViewPrintFormatter *viewFormatter = [self.webView viewPrintFormatter]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //判断是否支持更换图标 | |
| if(![[UIApplication sharedApplication] supportsAlternateIcons]) { | |
| return; | |
| } | |
| //更换icon,传入图标文件名 | |
| [[UIApplication sharedApplication] setAlternateIconName:@"shuiguo" completionHandler:^(NSError * _Nullable error) { | |
| }]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //特殊字符转码 | |
| - (NSString *)encodeWithString:(NSString *)string { | |
| NSString *charactersToEscape = @"?!@#$^&%*+,:;='\"`<>()[]{}/\\| "; | |
| NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:charactersToEscape] invertedSet]; | |
| return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters]; | |
| } | |
| //URL中包含中文的连接转码 | |
| NSString *escapedPath = [@"http://www.baidu.com?中文" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .view { | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } |
NewerOlder