1. 粘贴板
UIPasteboard * pastboard = [UIPasteboard generalPasteboard];
pastboard.string = @"123";
========================================
2. 配合调试输出
iOS底层是GCC,所以也支持 __func__标识符,用于打印当前函数名,配合__line__,可以说是排错利器。
3. button 取消高亮 和 文字图片居中()
Button.adjustsImageWhenHighlighted = NO;
(1)首先设置图片显示类型,避免拉伸
Button.imageView.contentMode = UIViewContentModeScaleAspectFit;
(2)如果是 左图片 右文字(button默认显示),只改变上下距离即可
Button.imageEdgeInsets = UIEdgeInsetsMake(10,0, 10,0);
(3)如果是 左文字 右图片,根据button子视图 imageView 和 titleLabel计算
[Button setTitleEdgeInsets:UIEdgeInsetsMake(0, -Button.imageView.image.size.width, 0, Button.imageView.image.size.width)];
[Button setImageEdgeInsets:UIEdgeInsetsMake(10, Button.titleLabel.bounds.size.width, 10, -self.Button.titleLabel.bounds.size.width)];
(4) 文字在上 图片在下
[button setTitleEdgeInsets:UIEdgeInsetsMake(button.imageView.size.height + 20 ,-button.imageView.frame.size.width, 0.0,0.0)];//文字距离上边框的距离增加imageView的高度,距离左边框减少imageView的宽度,距离下边框和右边框距离不变
[button setImageEdgeInsets:UIEdgeInsetsMake(-20, 0,0.0, -button.titleLabel.bounds.size.width)];//图片距离右边框距离减少图片的宽度,其它不变