工作小结

2018-12-20  本文已影响9人  41c48b8df394

在调用系统相机时,"cancel" 改为"取消",调用系统相册时,"photos" 改为 "相机",方法如下:

1.在 info.plist 添加 Localized resources can be mixed 并设值为YES
表示是否允许应用程序获取框架库内语言。

2.在info.plist 中添加或修改 Localization native development region 选择 china

  NSString *methodString = [NSString stringWithFormat:@"push%@Controller",itemModel.image];
    NSAssert(methodString, @"未找到对应methodKey对应handle方法");
        if (methodString) {
            SEL selector = NSSelectorFromString(methodString);
            IMP imp = [self.pushDelegate methodForSelector:selector];
            void (*func)(id, SEL) = (void *)imp;
            func(self.pushDelegate , selector);
        }

IQKeyboardManager

- (void)setKeyboardManager{
    IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager]; // 获取类库的单例变量
    
    keyboardManager.enable = YES; // 控制整个功能是否启用
    
    keyboardManager.shouldResignOnTouchOutside = YES; // 控制点击背景是否收起键盘
    
    keyboardManager.shouldToolbarUsesTextFieldTintColor = YES; // 控制键盘上的工具条文字颜色是否用户自定义
    
    keyboardManager.toolbarManageBehaviour = IQAutoToolbarBySubviews; // 有多个输入框时,可以通过点击Toolbar 上的“前一个”“后一个”按钮来实现移动到不同的输入框
    
    keyboardManager.enableAutoToolbar = YES; // 控制是否显示键盘上的工具条
    
    
    keyboardManager.placeholderFont = [UIFont boldSystemFontOfSize:17]; // 设置占位文字的字体
    
    keyboardManager.keyboardDistanceFromTextField = 10.0f; // 输入框距离键盘的距离
}

3 AFNetworking JSON数据

 AFHTTPSessionManager *manger = [AFHTTPSessionManager manager];
//请求post json数据
        manger.requestSerializer = [AFJSONRequestSerializer serializer];

        [manger.requestSerializer setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

4.优雅的隐藏导航栏

// 将要显示控制器
#pragma mark - UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    // 判断要显示的控制器是否是自己
    BOOL isSelf = [viewController isKindOfClass:[self class]];
    [self.navigationController setNavigationBarHidden:isSelf animated:YES];
}
上一篇 下一篇

猜你喜欢

热点阅读