Commit 3fec5bc1 authored by banchichen's avatar banchichen

加入国际化,目前支持英文和中文

parent 92f41997
......@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
6D32B9BD1CD83640005CE1E0 /* LxGridViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D32B9BC1CD83640005CE1E0 /* LxGridViewFlowLayout.m */; };
6D5358CD1D64600F00928CC6 /* NSBundle+TZImagePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D5358CC1D64600F00928CC6 /* NSBundle+TZImagePicker.m */; };
6DC358661CC8BAFD00898D29 /* TZImagePickerController.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 6DC358651CC8BAFD00898D29 /* TZImagePickerController.bundle */; };
900E65811C2BB8D5003D9A9E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 900E65801C2BB8D5003D9A9E /* main.m */; };
900E65841C2BB8D5003D9A9E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 900E65831C2BB8D5003D9A9E /* AppDelegate.m */; };
......@@ -47,8 +48,12 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
6D12FC191D66B71E00182C44 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
6D12FC1A1D66B71E00182C44 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
6D32B9BB1CD83640005CE1E0 /* LxGridViewFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LxGridViewFlowLayout.h; sourceTree = "<group>"; };
6D32B9BC1CD83640005CE1E0 /* LxGridViewFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LxGridViewFlowLayout.m; sourceTree = "<group>"; };
6D5358CB1D64600F00928CC6 /* NSBundle+TZImagePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+TZImagePicker.h"; sourceTree = "<group>"; };
6D5358CC1D64600F00928CC6 /* NSBundle+TZImagePicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+TZImagePicker.m"; sourceTree = "<group>"; };
6DC358651CC8BAFD00898D29 /* TZImagePickerController.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TZImagePickerController.bundle; sourceTree = "<group>"; };
900E657C1C2BB8D5003D9A9E /* TZImagePickerController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TZImagePickerController.app; sourceTree = BUILT_PRODUCTS_DIR; };
900E65801C2BB8D5003D9A9E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
......@@ -209,6 +214,8 @@
90CE84B61C3BABB6003D0779 /* TZVideoPlayerController.m */,
90EBF5D41C2E298000CB9BCC /* UIView+Layout.h */,
90EBF5D51C2E298000CB9BCC /* UIView+Layout.m */,
6D5358CB1D64600F00928CC6 /* NSBundle+TZImagePicker.h */,
6D5358CC1D64600F00928CC6 /* NSBundle+TZImagePicker.m */,
6DC358641CC8BAE300898D29 /* Resources */,
);
path = TZImagePickerController;
......@@ -358,6 +365,7 @@
900E65841C2BB8D5003D9A9E /* AppDelegate.m in Sources */,
900E65811C2BB8D5003D9A9E /* main.m in Sources */,
900EF0121C2C107400EA709B /* TZPhotoPreviewController.m in Sources */,
6D5358CD1D64600F00928CC6 /* NSBundle+TZImagePicker.m in Sources */,
900EEFF81C2BBF9500EA709B /* TZImagePickerController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -398,6 +406,7 @@
isa = PBXVariantGroup;
children = (
900E65891C2BB8D5003D9A9E /* Base */,
6D12FC191D66B71E00182C44 /* zh-Hans */,
);
name = Main.storyboard;
sourceTree = "<group>";
......@@ -406,6 +415,7 @@
isa = PBXVariantGroup;
children = (
900E658E1C2BB8D5003D9A9E /* Base */,
6D12FC1A1D66B71E00182C44 /* zh-Hans */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
......
......@@ -2,14 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......@@ -21,13 +15,17 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.6.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>访问相机以拍照</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>访问相册以选择照片</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
......@@ -39,8 +37,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
......
//
// NSBundle+TZImagePicker.h
// TZImagePickerController
//
// Created by 谭真 on 16/08/18.
// Copyright © 2016年 谭真. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NSBundle (TZImagePicker)
+ (NSString *)tz_localizedStringForKey:(NSString *)key value:(NSString *)value;
+ (NSString *)tz_localizedStringForKey:(NSString *)key;
@end
//
// NSBundle+TZImagePicker.m
// TZImagePickerController
//
// Created by 谭真 on 16/08/18.
// Copyright © 2016年 谭真. All rights reserved.
//
#import "NSBundle+TZImagePicker.h"
#import "TZImagePickerController.h"
@implementation NSBundle (TZImagePicker)
+ (instancetype)tz_imagePickerBundle {
static NSBundle *tzBundle = nil;
if (tzBundle == nil) {
tzBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"TZImagePickerController" ofType:@"bundle"]];
}
return tzBundle;
}
+ (NSString *)tz_localizedStringForKey:(NSString *)key {
return [self tz_localizedStringForKey:key value:@""];
}
+ (NSString *)tz_localizedStringForKey:(NSString *)key value:(NSString *)value {
static NSBundle *bundle = nil;
if (bundle == nil) {
NSString *language = [NSLocale preferredLanguages].firstObject;
if ([language rangeOfString:@"zh-Hans"].location != NSNotFound) {
language = @"zh-Hans";
} else {
language = @"en";
}
bundle = [NSBundle bundleWithPath:[[NSBundle tz_imagePickerBundle] pathForResource:language ofType:@"lproj"]];
}
NSString *value1 = [bundle localizedStringForKey:key value:value table:nil];
return value1;
}
@end
......@@ -681,7 +681,7 @@ static CGFloat TZScreenScale;
- (TZAlbumModel *)modelWithResult:(id)result name:(NSString *)name{
TZAlbumModel *model = [[TZAlbumModel alloc] init];
model.result = result;
model.name = [self getNewAlbumName:name];
model.name = name;
if ([result isKindOfClass:[PHFetchResult class]]) {
PHFetchResult *fetchResult = (PHFetchResult *)result;
model.count = fetchResult.count;
......@@ -695,24 +695,6 @@ static CGFloat TZScreenScale;
return model;
}
- (NSString *)getNewAlbumName:(NSString *)name {
if (iOS8Later) {
NSString *newName;
if ([name rangeOfString:@"Roll"].location != NSNotFound) newName = @"相机胶卷";
else if ([name rangeOfString:@"Stream"].location != NSNotFound) newName = @"我的照片流";
else if ([name rangeOfString:@"Added"].location != NSNotFound) newName = @"最近添加";
else if ([name rangeOfString:@"Selfies"].location != NSNotFound) newName = @"自拍";
else if ([name rangeOfString:@"shots"].location != NSNotFound) newName = @"截屏";
else if ([name rangeOfString:@"Videos"].location != NSNotFound) newName = @"视频";
else if ([name rangeOfString:@"Panoramas"].location != NSNotFound) newName = @"全景照片";
else if ([name rangeOfString:@"Favorites"].location != NSNotFound) newName = @"个人收藏";
else newName = name;
return newName;
} else {
return name;
}
}
- (UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)size {
if (image.size.width > size.width) {
UIGraphicsBeginImageContext(size);
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<objects>
......
......@@ -4,7 +4,7 @@
//
// Created by 谭真 on 15/12/24.
// Copyright © 2015年 谭真. All rights reserved.
// version 1.5.0
// version 1.6.0 - 2016.08.19
/*
经过测试,比起xib的方式,把TZAssetCell改用纯代码的方式来写,滑动帧数明显提高了(约提高10帧左右)
......@@ -17,6 +17,7 @@
#import <UIKit/UIKit.h>
#import "TZAssetModel.h"
#import "NSBundle+TZImagePicker.h"
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
......
......@@ -4,7 +4,7 @@
//
// Created by 谭真 on 15/12/24.
// Copyright © 2015年 谭真. All rights reserved.
//
// version 1.6.0 - 2016.08.19
#import "TZImagePickerController.h"
#import "TZPhotoPickerController.h"
......@@ -110,7 +110,8 @@
_tipLable.textColor = [UIColor blackColor];
NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"];
if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"];
_tipLable.text = [NSString stringWithFormat:@"请在%@的\"设置-隐私-照片\"选项中,\r允许%@访问你的手机相册。",[UIDevice currentDevice].model,appName];
NSString *tipText = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Allow %@ to access your album in \"Settings -> Privacy -> Photos\""],appName];
_tipLable.text = tipText;
[self.view addSubview:_tipLable];
_timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:YES];
......@@ -184,12 +185,12 @@
- (void)showAlertWithTitle:(NSString *)title {
if (iOS8Later) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDefault handler:nil]];
[alertController addAction:[UIAlertAction actionWithTitle:[NSBundle tz_localizedStringForKey:@"OK"] style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[[[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:@"我知道了" otherButtonTitles:nil, nil] show];
[[[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"OK"] otherButtonTitles:nil, nil] show];
#pragma clang diagnostic pop
}
}
......@@ -326,8 +327,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = @"照片";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Photos"];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Cancle"] style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
[self configTableView];
}
......
......@@ -69,7 +69,7 @@ static CGSize AssetGridThumbnailSize;
_shouldScrollToBottom = YES;
self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = _model.name;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Cancle"] style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
_showTakePhotoBtn = (([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"] || [_model.name isEqualToString:@"All Photos"]) && tzImagePickerVc.allowTakePicture);
if (!tzImagePickerVc.sortAscendingByModificationDate && _isFirstAppear && iOS8Later) {
[[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage completion:^(TZAlbumModel *model) {
......@@ -159,25 +159,28 @@ static CGSize AssetGridThumbnailSize;
CGFloat rgb = 253 / 255.0;
bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
NSString *previewText = [NSBundle tz_localizedStringForKey:@"Preview"];
CGFloat previewWidth = [previewText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width;
_previewButton = [UIButton buttonWithType:UIButtonTypeCustom];
_previewButton.frame = CGRectMake(10, 3, 44, 44);
_previewButton.frame = CGRectMake(10, 3, previewWidth + 2, 44);
[_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside];
_previewButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_previewButton setTitle:@"预览" forState:UIControlStateNormal];
[_previewButton setTitle:@"预览" forState:UIControlStateDisabled];
[_previewButton setTitle:previewText forState:UIControlStateNormal];
[_previewButton setTitle:previewText forState:UIControlStateDisabled];
[_previewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[_previewButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
_previewButton.enabled = tzImagePickerVc.selectedModels.count;
if (tzImagePickerVc.allowPickingOriginalPhoto) {
NSString *fullImageText = [NSBundle tz_localizedStringForKey:@"Full image"];
CGFloat fullImageWidth = [fullImageText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size.width;
_originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];
_originalPhotoButton.frame = CGRectMake(50, self.view.tz_height - 50, 130, 50);
_originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -8, 0, 0);
_originalPhotoButton.contentEdgeInsets = UIEdgeInsetsMake(0, -45, 0, 0);
_originalPhotoButton.frame = CGRectMake(CGRectGetMaxX(_previewButton.frame), self.view.tz_height - 50, fullImageWidth + 56, 50);
_originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
[_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside];
_originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_originalPhotoButton setTitle:@"原图" forState:UIControlStateNormal];
[_originalPhotoButton setTitle:@"原图" forState:UIControlStateSelected];
[_originalPhotoButton setTitle:fullImageText forState:UIControlStateNormal];
[_originalPhotoButton setTitle:fullImageText forState:UIControlStateSelected];
[_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
[_originalPhotoButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
[_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:tzImagePickerVc.photoOriginDefImageName] forState:UIControlStateNormal];
......@@ -186,7 +189,7 @@ static CGSize AssetGridThumbnailSize;
_originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;
_originalPhotoLable = [[UILabel alloc] init];
_originalPhotoLable.frame = CGRectMake(70, 0, 60, 50);
_originalPhotoLable.frame = CGRectMake(fullImageWidth + 46, 0, 80, 50);
_originalPhotoLable.textAlignment = NSTextAlignmentLeft;
_originalPhotoLable.font = [UIFont systemFontOfSize:16];
_originalPhotoLable.textColor = [UIColor blackColor];
......@@ -197,8 +200,8 @@ static CGSize AssetGridThumbnailSize;
_okButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 3, 44, 44);
_okButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_okButton addTarget:self action:@selector(okButtonClick) forControlEvents:UIControlEventTouchUpInside];
[_okButton setTitle:@"确定" forState:UIControlStateNormal];
[_okButton setTitle:@"确定" forState:UIControlStateDisabled];
[_okButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateNormal];
[_okButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateDisabled];
[_okButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
[_okButton setTitleColor:tzImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];
_okButton.enabled = tzImagePickerVc.selectedModels.count;
......@@ -359,7 +362,8 @@ static CGSize AssetGridThumbnailSize;
[tzImagePickerVc.selectedModels addObject:model];
[weakSelf refreshBottomToolBarStatus];
} else {
[tzImagePickerVc showAlertWithTitle:[NSString stringWithFormat:@"你最多只能选择%zd张照片",tzImagePickerVc.maxImagesCount]];
NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Select a maximum of %zd photos"], tzImagePickerVc.maxImagesCount];
[tzImagePickerVc showAlertWithTitle:title];
}
}
[UIView showOscillatoryAnimationWithLayer:weakLayer type:TZOscillatoryAnimationToSmaller];
......@@ -382,7 +386,7 @@ static CGSize AssetGridThumbnailSize;
if (model.type == TZAssetModelMediaTypeVideo) {
if (tzImagePickerVc.selectedModels.count > 0) {
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[imagePickerVc showAlertWithTitle:@"选择照片时不能选择视频"];
[imagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@"Can not choose both video and photo"]];
} else {
TZVideoPlayerController *videoPlayerVc = [[TZVideoPlayerController alloc] init];
videoPlayerVc.model = model;
......@@ -412,7 +416,10 @@ static CGSize AssetGridThumbnailSize;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// 无权限 做一个友好的提示
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"无法使用相机" message:@"请在iPhone的""设置-隐私-相机""中允许访问相机" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置", nil];
NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"];
if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"];
NSString *message = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Please allow %@ to access your camera in \"Settings -> Privacy -> Camera\""],appName];
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"Cancle"] otherButtonTitles:[NSBundle tz_localizedStringForKey:@"Setting"], nil];
[alert show];
#pragma clang diagnostic pop
} else { // 调用相机
......
......@@ -97,22 +97,23 @@
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (_tzImagePickerVc.allowPickingOriginalPhoto) {
NSString *fullImageText = [NSBundle tz_localizedStringForKey:@"Full image"];
CGFloat fullImageWidth = [fullImageText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size.width;
_originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];
_originalPhotoButton.frame = CGRectMake(5, 0, 120, 44);
_originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -8, 0, 0);
_originalPhotoButton.contentEdgeInsets = UIEdgeInsetsMake(0, -50, 0, 0);
_originalPhotoButton.frame = CGRectMake(0, 0, fullImageWidth + 56, 44);
_originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
_originalPhotoButton.backgroundColor = [UIColor clearColor];
[_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside];
_originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:13];
[_originalPhotoButton setTitle:@"原图" forState:UIControlStateNormal];
[_originalPhotoButton setTitle:@"原图" forState:UIControlStateSelected];
[_originalPhotoButton setTitle:fullImageText forState:UIControlStateNormal];
[_originalPhotoButton setTitle:fullImageText forState:UIControlStateSelected];
[_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
[_originalPhotoButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoPreviewOriginDefImageName] forState:UIControlStateNormal];
[_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoOriginSelImageName] forState:UIControlStateSelected];
_originalPhotoLable = [[UILabel alloc] init];
_originalPhotoLable.frame = CGRectMake(60, 0, 70, 44);
_originalPhotoLable.frame = CGRectMake(fullImageWidth + 42, 0, 80, 44);
_originalPhotoLable.textAlignment = NSTextAlignmentLeft;
_originalPhotoLable.font = [UIFont systemFontOfSize:13];
_originalPhotoLable.textColor = [UIColor whiteColor];
......@@ -124,7 +125,7 @@
_okButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44);
_okButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_okButton addTarget:self action:@selector(okButtonClick) forControlEvents:UIControlEventTouchUpInside];
[_okButton setTitle:@"确定" forState:UIControlStateNormal];
[_okButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateNormal];
[_okButton setTitleColor:_tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
_numberImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoNumberIconImageName]];
......@@ -176,7 +177,8 @@
if (!selectButton.isSelected) {
// 1. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
if (_tzImagePickerVc.selectedModels.count >= _tzImagePickerVc.maxImagesCount) {
[_tzImagePickerVc showAlertWithTitle:[NSString stringWithFormat:@"你最多只能选择%zd张照片",_tzImagePickerVc.maxImagesCount]];
NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Select a maximum of %zd photos"], _tzImagePickerVc.maxImagesCount];
[_tzImagePickerVc showAlertWithTitle:title];
return;
// 2. if not over the maxImagesCount / 如果没有超过最大个数限制
} else {
......@@ -186,7 +188,7 @@
[self.photos addObject:_photosTemp[_currentIndex]];
}
if (model.type == TZAssetModelMediaTypeVideo) {
[_tzImagePickerVc showAlertWithTitle:@"多选状态下选择视频,默认将视频当图片发送"];
[_tzImagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@"Select the video when in multi state, we will handle the video as a photo"]];
}
}
} else {
......@@ -298,7 +300,7 @@
#pragma mark - Private Method
- (void)dealloc {
NSLog(@"dealloc");
// NSLog(@"dealloc");
}
- (void)refreshNaviBarAndBottomBarState {
......
......@@ -30,7 +30,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
self.navigationItem.title = @"视频预览";
self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Preview"];
[self configMoviePlayer];
}
......@@ -53,7 +53,7 @@
}
/// Show progress,do it next time / 给播放器添加进度更新,下次加上
-(void)addProgressObserver{
- (void)addProgressObserver{
AVPlayerItem *playerItem = _player.currentItem;
UIProgressView *progress = _progress;
[_player addPeriodicTimeObserverForInterval:CMTimeMake(1.0, 1.0) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
......@@ -84,7 +84,7 @@
_okButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44);
_okButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_okButton addTarget:self action:@selector(okButtonClick) forControlEvents:UIControlEventTouchUpInside];
[_okButton setTitle:@"确定" forState:UIControlStateNormal];
[_okButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateNormal];
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[_okButton setTitleColor:imagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
......
/* Class = "UILabel"; text = "允许选择照片原图"; ObjectID = "7mi-Lf-2N5"; */
"7mi-Lf-2N5.text" = "允许选择照片原图";
/* Class = "UILabel"; text = "显示内部拍照按钮"; ObjectID = "R92-Zn-NWV"; */
"R92-Zn-NWV.text" = "显示内部拍照按钮";
/* Class = "UILabel"; text = "照片按修改时间升序排列"; ObjectID = "UL3-n3-Hmt"; */
"UL3-n3-Hmt.text" = "照片按修改时间升序排列";
/* Class = "UILabel"; text = "把拍照按钮放在外面"; ObjectID = "jop-5R-ioj"; */
"jop-5R-ioj.text" = "把拍照按钮放在外面";
/* Class = "UILabel"; text = "允许选择照片"; ObjectID = "vNN-OI-9z1"; */
"vNN-OI-9z1.text" = "允许选择照片";
/* Class = "UILabel"; text = "允许选择视频"; ObjectID = "xCu-D3-IZg"; */
"xCu-D3-IZg.text" = "允许选择视频";
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment