“我正在参与「启航计划」”

引言

iOS处理言语东西CFStringTransform : 智能地处理用户的输入内容,经典运用场景【索引】

  • 通讯录demo源码

download.csdn.net/download/u0… 1、原理:经过对用户输入内容,运用CFStringTransform变换,能够轻松完成完成一个通用的查找index 2、 特征:查找内容能够是多言语的 3、文章:https://kunnan.blog.csdn.net/article/details/109603377

I 、通讯录

1.1 常识储藏

有2个结构能够拜访用户的通讯录:

AddressBookUI.framework:供给了联系人列表界面、联系人概况界面、添加联系人界面等;一般用于挑选联系人 AddressBook.framework:纯C言语的API,仅仅是获得联系人数据;没有供给UI界面展现,需求自己建立联系人展现界面;里边的数据类型大部分根据Core Foundation结构,要经常进行类型转化。运用麻烦。

联系人特点包括以下类型

简略特点:姓、名等;多重特点:电话号码、电子邮件等;组合特点:地址等

请求通讯录拜访授权的代码,通常放在AppDelegate中

1.2 事例

iOS处理言语东西CFStringTransform : 智能地处理用户的输入内容,经典运用场景【索引】

  • 从CSDN下载通讯录demo源码

download.csdn.net/download/u0… 1、原理:经过对用户输入内容,运用CFStringTransform变换,能够轻松完成完成一个通用的查找index 2、 特征:查找内容能够是多言语的 3、文章:https://kunnan.blog.csdn.net/article/details/109603377

II 、 iOS APP 内的本地化切换

从CSDN下载【iOS APP 内的国际化切换】demo源码:https://download.csdn.net/download/u011018979/19089505

文章:kunnan.blog.csdn.net/article/det… 原理: 1、自界说解析本地化字符串的东西类LanguageManager 2、运用内切换言语收效的技能完成:选用毁掉根控制器,从头进入一次 3、本地化字符串指定参数顺序

———————————————— 版权声明:本文为CSDN博主「#大众号:iOS逆向」的原创文章,遵从CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:blog.csdn.net/z929118967/…

III、界面结构

iOS小技能:通讯录

1、push的时分躲藏buttomBar

iOS小技能:通讯录

2、staticcells类型的tableView,现已确定了分组和分组的cell个数,在vc中完成的代理办法应该返回分组数字不应该小于xib的分组数。

3.1 结构规划

1、规划一个主头文件,来包含结构内部所有的头文件 2、怎么接口文件仅仅用于声明的话,尽量运用@class,而不是#import

#import <UIKit/UIKit.h>
@class HSContactsModel;

3、安装数据时,要确保现已存在视图

@property (nonatomic,strong) HSContactsModel *model;//模型特点,的setter办法假如在跳转到VC之前调用,不会达到安装view的成果--由于VC的View只要在要显现的时分才加载,

4、自界说cell的小常识点

 #pragma mark 模版提高的办法
/**   初始化办法
 运用代码创建cell的时分会被调用;若运用xib或许storyBoard创建cell控件的话,此办法不会被调用
 */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];//承继父类信息
    if (self) {
        //设置特性信息
    }
    return self;
}
/**
 Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
 xib文件每次被加载之后,会调用此办法;若运用纯代码创建cell控件的时分,不会调用此办法
 */
- (void)awakeFromNib {
    // Initialization code
}
/**
 Sets the selected state of the cell, optionally animating the transition between states.
 1.cell控件被选中或许取消选中的时分,都会调用此办法
 2.假如是自界说cell,则cell的子控件都应该添加到contentView中
 */
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
    if (selected) {
        [self.contentView setBackgroundColor:[UIColor lightGrayColor]];
    }else{
        [self.contentView setBackgroundColor:[UIColor whiteColor]];
    }
}

cell的frame,由tableView决议(父视图的frame改变的时分,会从头布局子控件)

#pragma mark - setTransform 处理
//Tells the view that its superview changed. 当时的控件加载到父控件(tableview)的时分调用
- (void)didMoveToSuperview{
    NSLog(@"%s 9999",__func__);
    //2.对button的imageView的image进行平移、翻滚--先加载数据,在设置平移
    CGFloat angle = (self.friendsGroup.isOpen) ? M_PI_2 :0;
    [self.titleButtonView.imageView setTransform:CGAffineTransformMakeRotation(angle)];
}
/**当父控件(self)frame发生改变的时分会调用此办法,进行子控件的从头布局  */
- (void)layoutSubviews{
    [self.titleButtonView setFrame:self.bounds];
    CGFloat onlineWidth = 150 ;
    CGFloat onlineX =CGRectGetWidth(self.frame) - onlineWidth - KPading ;
    CGFloat onlineY = KPading ;
    CGFloat onlineHright =CGRectGetHeight(self.frame)- 2*KPading;
    [self.onlineLableView setFrame:CGRectMake(onlineX, onlineY, onlineWidth, onlineHright)];
}

3.2 开发标准

  • 宏的变量称号以项目名前缀开头
  • 本地化设置--针对iOS官方控件
    iOS小技能:通讯录

另:CFBundleAllowMixedLocalizations 开启体系预界说的本地化功用

info plist 的配置信息:

<key>CFBundleAllowMixedLocalizations</key>
 <true/>

从CSDN下载【iOS APP 内的国际化切换】demo源码:https://download.csdn.net/download/u011018979/19089505

文章:kunnan.blog.csdn.net/article/det… 原理: 1、自界说解析本地化字符串的东西类LanguageManager 2、运用内切换言语收效的技能完成:选用毁掉根控制器,从头进入一次 3、本地化字符串指定参数顺序

———————————————— 版权声明:本文为CSDN博主「#大众号:iOS逆向」的原创文章,遵从CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:blog.csdn.net/z929118967/…

  • Launch Screen Constraints

The system loads the launch screen file before launching the app which creates some constraints on what it can contain (some of which may force you back to static image files): The app is not yet loaded so the view hierarchy does not exist and the system can not call any custom view controller setup code you may have in the app (e.g. viewDidLoad) You can only use standard UIKit classes so you can use UIView or UIViewController but not a custom subclass. If you try to set a custom class you will get an Illegal Configuration error in Xcode. The launch screen file can only use basic UIKit views such as UIImageView and UILabel. You cannot use a UIWebView. If you are using a storyboard you can specify multiple view controllers but there are again some limitations. For example you can embed view controllers in a navigation or tab bar controller but more complex container classes such as UISplitViewController do not work (at least not yet). Localizing the launch screen file does not currently seem to have any effect. The base localization is always used so you will probably want to avoid text on the launch screen. You cannot specify different launch screen files for iPad and iPhone. This may be a problem if you have significantly different interfaces for those devices as there is only so much you can do with auto layout and size classes.

另:640 960 pixels、640 1136 pixels。 假如不设置这两种的尺寸发动页的话,在4英寸、3.5英寸的设备上展现不了发动页,app 的高度也默许都是矮的960px.

• 留意@3x 供给给开发的px 为12422208 ,但实在的px 是10801920,体系API会主动进行等比例缩小;

  • 判别对象的class
//        [self isMemberOfClass:]// 判别是否为本类  whether the receiver is an instance of a given class.
//    [self isKindOfClass:];//   判别是否为本类 或许子类 whether the receiver is an instance of given class or an instance of any class that inherits from that class.
  • 像素与点的转化:

通常将像素除以2的到点,iOS都是以点(point)为单位。

iOS小技能:通讯录
@3x 的时分,逻辑分辨率与点的关系就是3倍。

  • UITabBarController

UITabBarItem view显现的内容由对应子控制器的tabBarItem特点决议

[redVc.tabBarItem setTitle:@"red"];
 redVc.tabBarItem setImage:(UIImage * _Nullable)

3.3 归档的留意事项(NSCoding协议的运用)

 运用一个新办法,需清晰本办法什么时分调用,以及办法的效果
#import "HSCustomView.h"
@implementation HSCustomView
/*
1、优先级
 2016-04-07 18:51:21.396 20160407-plist方法存储[5546:241416] -[HSCustomView initWithCoder:]
 2016-04-07 18:51:21.398 20160407-plist方法存储[5546:241416] -[HSCustomView awakeFromNib]
2/假如父类也恪守了NSCoding协议,请留意:-
[super encodeWithCode:encode];确保承继的实例变量也能被编码,即也能被归档
p s:--UIView 就是个典型的例子,UIView的子类必学完成initWithCoder:decoder,否则无法承继父类特点。
*/
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    NSLog(@"%s",__func__);
    self = [super initWithCoder:aDecoder];//完成父类,承继父类特点
    return self;
}
- (void)awakeFromNib{
    NSLog(@"%s",__func__);
}

3.4 其他小常识点

1、 假如第三方库是MRC,通常最简洁的计划是:将其打包成静态库直接运用。

2、Bundle

就是资源文件包。咱们将许多图片、XIB、文本文件组织在一起,打包成一个Bundle文件。方便在其他项目中引用包内的资源。

Bundle文件的特点:Bundle是静态的,也就是说,咱们包含到包中的资源文件作为一个资源包是不参与项目编译的。也就意味着,bundle包中不能包含可执行的文件。它仅仅是作为资源,被解析成为特定的2进制数据。

see also

公号:iOS逆向