「这是我参与2022首次更文挑战的第42天,活动详情查看:2022首次更文挑战」。
I 图片平移&旋转处理
列表的分组headView的图片平移、旋转处理
1.1 image平变量英文移处理
#pragma mark - setTransform 处理 //Tells the view that its superview changed. 当前的控件加载到父控件(tableview)的时候调用 - (void)didMoveToSuperview{ NSLog(@"%s",__func__); //2.对button的imageView的image进行平移、翻滚--先加载数据,在设置平移 CGFloat angle = (self.friendsGroup.isOpen) ? M_PI_2 :0; [self.titleButtonView.imageView setTransform:CGAffineTransformMakeRotation(angle)]; } //对imageView进行内容排列对齐方式、是否剪切超出部分进行设置 [_titleButtonView.imageView setContentMode:UIViewContentModeCenter]; [_titleButtonView.imageView setClipsToBounds:NO];//subviews are confined to the bounds of the view. 不剪切超出的部分
1.2 图片的拉伸处理
消息按钮的背景图片ImageView、titleLa指针变量不占用存储空间bel,以及button本身之间的大小关系处理



1.ios123 图片拉伸
确定图片可调整的小矩形resizableImageWithCapInsets:
(确定可拉伸、平铺的的小矩形)。变量类型有哪些
获取可拉伸图片:确定填充“拉伸之后的空白区域”的小矩形
#pragma mark - 获取可拉伸图片--确定填充“拉伸之后的空白区域”的小矩形 - (UIImage *)resizableImageWithImage:(UIImage *) image{ CGFloat widthForTopORBottom = image.size.width*0.5f -1;//inset的top、bottom CGFloat heightForLeftORRight = image.size.height*0.5f -1;//inset的left、right UIImage *resizableImage = [image resizableImageWithCapInsets:UIEdgeInsetsMake(heightForLeftORRight, widthForTopORBottom, heightForLeftORRight, widthForTopORBottom)]; return resizableImage; }
II 其他相关知识点
2.逆向思维案例100个1 键盘处理
[center addObserver:self selector:@selector(keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil];//监听键盘通知 #pragma mark - scrollView 的代理方法 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ NSLog(@"%s",__func__); //关闭键盘 [self.view endEditing:YES]; }
/** 键盘弹出的frame 2016-03-28 09:41:27.498 20160525-QQinterface[842:16465] NSConcreteNotification 0x7b274c00 {name = UIKeyboardDidChangeFrameNotification; userInfo = { UIKeyboardAnimationCurveUserInfoKey = 7; UIKeyboardAnimationDurationUserInfoKey = "0.25"; UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 253}}"; UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 606.5}"; UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 353.5}"; UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 480}, {320, 253}}"; UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 227}, {320, 253}}"; UIKeyboardIsLocalUserInfoKey = 1; }} */ /** 关闭键盘时候的frame信息*/ 2016-03-28 09:41:30.775 20160525-QQinterface[842:16465] -[ViewController scrollViewWillBeginDragging:] 2016-03-28 09:41:31.287 20160525-QQinterface[842:16465] NSConcreteNotification 0x7b21cae0 {name = UIKeyboardDidChangeFrameNotification; userInfo = { UIKeyboardAnimationCurveUserInfoKey = 7; UIKeyboardAnimationDurationUserInfoKey = "0.25"; UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 253}}"; UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 353.5}"; UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 606.5}"; UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 227}, {320, 253}}"; UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 480}, {320, 253}}"; UIKeyboardIsLocalUserInfoKey = 1; }}
处理键盘的属性:谁负责唤起键盘,谁去逆向生长修改键盘属性信息
UIKeyboardWillChangeFrameNotification object:nil]; //2.处理textFieldView的输入控件 self.textFieldView.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 8, 0)]; self.textFieldView.leftViewMode = UITextFieldViewModeWhileEditing; //3.键盘信息处理原则:谁触发键盘弹出的,谁去负责处理键盘的属性 [self.textFieldView setReturnKeyType:UIReturnKeySend]; [self.textFieldView setEnablesReturnKeyAutomatically:YES];// indicating whether the Return key is automatically enabled when the user is entering text
2.2 关于控件没显示的经逆向选择验小结:
- 父控件的frame
- 当前控件的frame
- 当前控件的hidden属性
- 当前控件的alpha<= 0.01
2.3 UIDevice
UIDevice类提高了一个单例对象,它代表着设备;通过它可以获取一些设备相关的信息(batteriOSyLevel、batteryState、model、systemVers逆向ion)
•通过[UIDevice currentDevice]可以获变量是什么意思取这个指针c语言单粒对象
2.4 ARC的介绍
ARC 是编译器特性,而不是IOS运行时特性,它也不类似ios是什么意思于其他语言的垃圾收集器(指针万用表的使用方法GC)
#import "Person.h"
@implementation Person
/** ARC 是编译器特性,而不是IOS运行时特性,它也不类似于其他语言的垃圾收集器(GC)
1)ARC的规则:只要还有一个变量指向对象,对象就会保持在内存中-- 默认所有的实例变量和局部变量都是strong指针,因为它们能保持对象的生命。
2)OC中有强参照strong和弱参照weak。--weak型的指针变量仍然可以指向一个对象,但不属于这个对象的拥有者;weak指针主要用于父子关系,即父亲拥有一个儿子的strong指针,儿子需使用weak指针指向父亲。
典型的例子:
你的ViewControl通过strong指针(self.view)拥有一个UITableView,UITableView的dataSource和delegate都是weak指针,指向你的viewControl
@property(null_resettable, nonatomic,strong) UIView *view;
@property (nonatomic, weak, nullable) id <UITableViewDelegate> delegate;
3)在ARC(代码的一种静态分析工具)中dealloc 主要用于调试,判断对象被释放。可以用来管理一些资源,
*** an implementation of dealloc, do not invoke the superclass’s implementation 不能调用[super dealloc]
*** 在ARC下父类的dealloc同样由编译器自动完成,不能用来释放实例变量;
4)在ARC中考虑的是对象之间的关联,也就是那个对象拥有哪个对象。--无论何时你创建一个对象时,都要考虑谁该拥有它,以及这个对象需要存活多久
5)ARC只能工作于OC。
如果应用了core foundation,malloc()、free(),此时还是需要你来手动管理
*/
- (void) dealloc{
NSLog(@"Person %@被释放 %s ",self.name,__FUNCTION__);
}
@end
2.5 调试技巧
- po 关键字的使ios模拟器用--打印内存对象
(lldb) po notification
NSConcreteNotification 0x10010eb20 {name = zhengaiwang; object = <HSMatchmakingCompany: 0x100206170>; userInfo = {
info = "....";
title = "\U65b0\U6765\U4e86\U4e00\U6279\U7f8e\U5973";
}}
- 清空cell的颜色
[cell setBackgroundColor:[UIColor clearColor]]; [self.tableView setBackgroundColor:[UIColor colorWithRed:221/255.0 green:221/255.0 blue:221/255.0 alpha:1]];
see also
iOS解决压缩之后图片模糊的问题
blog.csdn.net/z929指针式万用表表盘详解118967/…
联系作者: iOS逆向(公号:iosrev)
作者简介:CSDN 博客专家认证丨全站 Top 50、华为云云享专家认证、iOS逆向公号号主
简历模板、技术互助。关注我,都给你。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)