NSObject
—————————————————————————————————————————
—————————————————————————————————————————
1. UIAcceleration
2. UIAccelerometer 加速计(iOS2 ~ iOS5)
/* UIAcceleration and UIAccelerometer are deprecated as of iOS 5.0. These classes have been replaced by the Core Motion framework.*/
3. UIAccessibilityElement
/** UIAcceleration /UIAccelerometer /UIAccessibilityElement
UIAccessibility 非正式协议,提供关于UI元素的辅助功能信息,
在UIKit里的所有标准视图和控件都是实现了UIAccessibility协议,所有应用默认是可以被肢体障碍者使用的。 可做一些细微调整,不必全部重新实现。
开启辅助功能
VoiceOver 读屏
*/
4. UIBarItem
5. UIColor
6. UIDevice
//testtesttest.................
// 设备信息
UIDevice *device = [UIDevice currentDevice];
DLog(@"name = %@, \n, model = %@, \n, localizedModel = %@, \n, systemName = %@, \n, systemVersion = %@, \n ", device.name, device.model, device.localizedModel, device.systemName, device.systemVersion);
DLog(@"orientation = %zd", device.orientation); // home button
DLog(@"generatesDeviceOrientationNotifications = %d", device.generatesDeviceOrientationNotifications); //
DLog(@"batteryState = %zd", device.batteryState); // 电池的状态
DLog(@"batteryLevel = %f", device.batteryLevel);
// 设备标识
DLog(@"identifierForVendor = %@", device.identifierForVendor.UUIDString); // 相同的一个程序里面-相同的vindor-相同的设备---> 值相同, 卸载重装会被重置
// DLog(@"OpenUDID = %@", [OpenUDID value]);
DLog(@"advertisingIdentifier = %@", [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]); //#import <AdSupport/AdSupport.h>
DLog(@"userInterfaceIdiom = %zd, \n UI_USER_INTERFACE_IDIOM = %zd", device.userInterfaceIdiom, UI_USER_INTERFACE_IDIOM()); // iPhone iPad TV carPlay
/**
模拟器 iPhone SE - iOS 10.0(14A345) 输出 :
name = weiphone的iMac (2),
, model = iPhone,
, localizedModel = iPhone,
, systemName = iPhone OS,
, systemVersion = 10.0,
orientation = 1
generatesDeviceOrientationNotifications = 1 //UIDeviceOrientationPortrait, home button on the bottom
batteryState = 0
batteryLevel = -1.000000
identifierForVendor = D90E4491-BCE7-48D4-82C1-AB372755E83D
advertisingIdentifier = DC56A219-6AC8-436F-9952-6144EA46AED5
*/
//testtesttest.................
7. UIEvent 事件
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// 触摸事件:通过触摸、手势进行触发,例如手指点击、缩放
}
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
// 运动事件:通过加速器进行触发(例如手机晃动)
}
- (void)remoteControlReceivedWithEvent:(UIEvent *)event
{
// 远程遥控事件:远程控制事件通过其他远程设备触发(例如耳机控制按钮)
}
// iOS摇一摇功能的实现(运动事件的运用)
[UIApplication sharedApplication].applicationSupportsShakeToEdit = YES; //设置允许摇一摇功能
[self becomeFirstResponder]; // 并让自己成为第一响应值
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
// 摇一摇相关方法
DLog(@"开始摇动。。。。。。");
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
DLog(@"摇动结束。。。。。。。");
}
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
DLog(@"取消摇动。。。。。。");
}
// 音乐远程控制
8. UITouch 触摸
// 1.触摸时,图片移动(实例)
// 2.创建可以拖动的视图
9. UIFont 字体
/**UIFont
+ (nullable UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize; //设置字体名称,大小
字体集: HelveticaNeue-Light , STHeiti-Light 等
iOS9之后:PingFangSC-Medium, PingFangSC-Regular
*/
10. UIImage 图片
11. UILocalizedIndexedCollation/UILocalNotification
UILocalizedIndexedCollation 区域索引排序
@class Person;
@interface WFView ()<UITableViewDelegate, UITableViewDataSource>
@property (copy, nonatomic) NSArray *dataSource;
@end
@implementation WFView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initView];
}
return self;
}
- (void)initView
{
UITableView *tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStyleGrouped];
tableView.delegate = self;
tableView.dataSource = self;
[self addSubview:tableView];
/** UILocalizedIndexedCollation 区域索引排序
*/
NSArray *originalArray = @[@"aaaa", @"aadsd", @"basasf", @"cd", @"fffdfg", @"edfsfs", @"sdffa", @"fhfdhdf", @"lkofw", @"你好", @"什么", @"在吗", @"盲目", @"是吧", @"诶发", @"威锋", @"游戏", @"区域", @"导航栏", @"按钮", @"文本", @"醉了", @"最后", @"还好呢"];
NSMutableArray *personArr = [NSMutableArray arrayWithCapacity:originalArray.count];
for (NSString *str in originalArray) {
Person *person = [[Person alloc] initWithName:str];
[personArr addObject:person];
}
UILocalizedIndexedCollation *collation = [UILocalizedIndexedCollation currentCollation];
DLog(@">>>>>>>>>> collation.sectionTitles = %@", collation.sectionTitles); // A,B,C,D,E,,,,,X,Y,Z,#
//1.获取section标题
NSArray *sectionTitles = collation.sectionTitles;
//2.构建每个section数组
NSMutableArray *sectionArray = [NSMutableArray arrayWithCapacity:sectionTitles.count];
for (int i = 0; i < sectionTitles.count; i++) {
NSMutableArray *subArr = [NSMutableArray array];
[sectionArray addObject:subArr];
}
//3.排序
//按照将需要排序的对象放入到对应分区数组
for (Person *person in personArr) {
NSInteger section = [collation sectionForObject:person collationStringSelector:@selector(name)];
NSMutableArray *subArr = sectionArray[section];
[subArr addObject:person];
}
//分别对分区进行排序
for (NSMutableArray *subArr in sectionArray) {
NSArray *sortArr = [collation sortedArrayFromArray:subArr collationStringSelector:@selector(name)];
[subArr removeAllObjects];
[subArr addObjectsFromArray:sortArr];
}
//修改数据源
self.dataSource = [NSArray arrayWithArray:sectionArray];
}
#pragma mark SectionTitles
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if ([self.dataSource[section] count] == 0) {
return nil;
}
return [[