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 *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; | |
NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; | |
NSString *buildVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; |
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
// 加密 | |
public static byte[] ecbEncrypt(byte sSrc[], String sKey) throws Exception { | |
if (sKey == null) { | |
System.out.print("Key为空null"); | |
return null; | |
} | |
// 判断Key是否为16倍数 | |
if (sKey.length() % 16 != 0) { | |
System.out.print("Key长度不是16倍数"); |
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
/**将二进制转换成16进制 | |
* @param buf | |
* @return | |
*/ | |
public static String parseByte2HexStr(byte buf[]) { | |
StringBuffer sb = new StringBuffer(); | |
for (int i = 0; i < buf.length; i++) { | |
String hex = Integer.toHexString(buf[i] & 0xFF); | |
if (hex.length() == 1) { | |
hex = '0' + hex; |
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
// We don't need to keep making new NSData objects. We can just use one repeatedly. | |
__block NSMutableData *data = [NSMutableData dataWithLength:blockSize]; | |
__block RNEncryptor *decryptor = nil; | |
dispatch_block_t readStreamBlock = ^{ | |
[data setLength:blockSize]; | |
NSInteger bytesRead = [cryptedStream read:[data mutableBytes] maxLength:blockSize]; | |
if (bytesRead < 0) { | |
// Throw an 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
// 调试中文 | |
#define Debug_Language_Chinese 0 | |
// 调试英文 | |
#define Debug_Language_English 0 | |
#define AppLanguage @"appLanguage" | |
#define AppLanguage_ZH_CN @"zh-Hans" | |
#define AppLanguage_EN_US @"en" | |
#if Debug_Language_Chinese |
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
- (UIImage *)resizeImageToSize:(CGSize)targetSize | |
{ | |
UIImage *sourceImage = captureImage; | |
UIImage *newImage = nil; | |
CGSize imageSize = sourceImage.size; | |
CGFloat width = imageSize.width; | |
CGFloat height = imageSize.height; | |
CGFloat targetWidth = targetSize.width; |
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
- (IBAction)handleUploadButton:(id)sender { | |
if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear] == NO | |
&& [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront] == NO) { | |
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:CustomLocalizedString(@"alert_cancel", nil) destructiveButtonTitle:nil otherButtonTitles:CustomLocalizedString(@"picker_photo", nil), nil]; | |
[sheet showFromRect:((UIButton *)sender).frame inView:self.view animated:YES]; | |
} else { | |
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:CustomLocalizedString(@"alert_cancel", nil) destructiveButtonTitle:CustomLocalizedString(@"picker_camera", nil) otherButtonTitles:CustomLocalizedString(@"picker_photo", nil), nil]; | |
[sheet showFromRect:((UIButton *)sender).frame inView:self.view animated:YES]; | |
} | |
} |
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
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
NSString *cellId = [self.cells objectAtIndex:indexPath.row]; | |
if ([cellId isEqualToString:kCellId_DevicesCell]) { | |
return 94.0f; | |
} else { | |
UITableViewCell *cell = [self configCellForTableView:tableView cellForRowAtIndexPath:indexPath]; | |
return [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; | |
} | |
} |
NewerOlder