摘要:
//注意:要获取safeAreaInsets最好的办法是重写viewSafeAreaInsetsDidChange函数,在里面获取。因为viewDidLoad之前,safeAreaInsets是0值。并且屏幕也会转动。 override func viewSafeAreaInsetsDidChange () { print(view.safeAreaInsets.bott... 阅读全文
随笔档案-2018年08月
Swift自定义(可变参)打印函数
2018-08-22 17:48 by 法子, 554 阅读, 收藏, 编辑
摘要:
/// 单参数打印函数 /// /// - Parameters: /// - message:打印 /// - file: 文件名,默认值:#file /// - line: 第几行,默认值:#line /// - method: 函数名,默认值:#function func printLog(_ message:... 阅读全文
sizeToFit 和 sizeThatFits
2018-08-22 17:32 by 法子, 515 阅读, 收藏, 编辑
摘要:
//文档//显示是UIView的extension。UILabel, UITextField, UITextView都可以调用 extension UIView { ... open func sizeThatFits(_ size: CGSize) -> CGSize // return 'best' size to fit given size. does not actua... 阅读全文
修改UITextfield的的默认的删除按钮图片
2018-08-22 17:09 by 法子, 2463 阅读, 收藏, 编辑
摘要:
UIButton *userNameClearButton = [self.usernameTextField valueForKey:@"_clearButton"]; [userNameClearButton setImage:[UIImage imageNamed:@"login_icon_clear"] forState:UIControlStateNormal]; 阅读全文
修改UITextfield的Placeholder字体的颜色
2018-08-22 17:05 by 法子, 443 阅读, 收藏, 编辑
摘要:
//两种办法 //attributedPlaceholder self.usernameTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"xxx" attributes:@{NSForegroundColorAttributeName: [UIColor redCo... 阅读全文