TmpCode
// ————— 通知 ———//
/*
UNMutableNotificationContent * notifiContent = [[UNMutableNotificationContent alloc] init];
// notifiContent.title = [abs valueForKey:@"title"];
// notifiContent.body = [aps valueForKey:@"alert"];
notifiContent.sound = [UNNotificationSound defaultSound];
UNNotificationRequest * notifiRequest = [UNNotificationRequest requestWithIdentifier:@"ystIdenfy" content:notifiContent trigger:nil];
[_notificationCenter addNotificationRequest:notifiRequest withCompletionHandler:^(NSError * _Nullable error) {
}];
*/
icon BadgeNumber
// UIApplication *application = [UIApplication sharedApplication];
// [application setApplicationIconBadgeNumber:unreadCount];
//
// self.view pointInside:<#(CGPoint)#> withEvent:<#(nullable UIEvent *)#>
// self.view hitTest:<#(CGPoint)#> withEvent:<#(nullable UIEvent *)#>
// push 效果 显示 模态控制器
BusinessWebController * businessVC = [[BusinessWebController alloc] init];
// UINavigationController * businessNav = [[UINavigationController alloc] initWithRootViewController:businessVC];
// businessNav.modalTransitionStyle
// MainViewController * mainVC = [MainViewController sharedMainVC];
[UIApplication sharedApplication].keyWindow.rootViewController = businessVC;
[UIApplication sharedApplication].keyWindow.backgroundColor = [UIColor whiteColor];
// UIView * v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 64)];
// v.backgroundColor = RedColor;
// [[UIApplication sharedApplication].keyWindow addSubview:v];
// [mainVC addChildViewController:businessVC];
// mainVC.tabBarController.tabBar.hidden = YES;
// [mainVC.view addSubview:businessVC.view];
CATransition *transition = [CATransition animation];
transition.duration = 0.15;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
transition.delegate = self;
[businessVC.view.layer addAnimation:transition forKey:nil];
// [mainVC.view.layer addAnimation:transition forKey:nil];
// [mainVC presentViewController:businessVC animated:YES completion:nil];
/// 版本比较
NSString * str1 = @"1.3.0";
NSString * newStr= @"1.3.1";
if ([newStr compare:str1 options:NSNumericSearch] == NSOrderedDescending) {
NSLog(@"1.3.1 high");
}
/// ============= - - ==========================///
/// 毛玻璃
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
UIVisualEffectView *effectview = [[UIVisualEffectView alloc] initWithEffect:blur];
effectview.alpha = 0.9;
effectview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:effectview];
/// =============- -=====================///
#import <JavaScriptCore/JavaScriptCore.h>
javascriptcore.framework js 操作oc
/// ====== jia gou =======
1. 用户模型 单例
//—————————— LOG 调试 ——————//
/**
* 黑屏bug
*/
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths firstObject];
NSLog(@"path:%@", path);
// NSString * path = @"/Users/fcrj/Desktop/";
NSString * filePath = [path stringByAppendingPathComponent:@"bug.plist"];
NSMutableArray * aaa = [[NSMutableArray alloc] init];
NSMutableArray * xxx = [NSMutableArray arrayWithContentsOfFile:filePath];
if (xxx) {
aaa = xxx;
}else{
}
[aaa addObject:@"login"];
if ([aaa writeToFile:filePath atomically:YES]) {
NSLog(@"写入成功");
}
// ======== ios 沙盒
iphone沙箱模型的有四个文件夹,分别是什么,永久数据存储一般放在什么位置,得到模拟器的路径的简单方式是什么.
documents,tmp,app,Library。
手动保存的文件在documents文件里,Nsuserdefaults保存的文件在Library/Preferences 目录文件夹里;
· Documents 目录:您应该将所有de应用程序数据文件写入到这个目录下。这个目录用于存储用户数据或其它应该定期备份的信息。
· AppName.app 目录:这是应用程序的程序包目录,包含应用程序的本身。由于应用程序必须经过签名,所以您在运行时不能对这个目录中的内容进行修改,否则可能会使应用程序无法启动。
· Library 目录:这个目录下有两个子目录:Caches 和 Preferences
· Library/Preferences 目录:包含应用程序的偏好设置文件。您不应该直接创建偏好设置文件,而是应该使用NSUserDefaults类来取得和设置应用程序的偏好.
· Library/Caches 目录:用于存放应用程序专用的支持文件,保存应用程序再次启动过程中需要的信息。
· tmp 目录:这个目录用于存放临时文件,保存应用程序再次启动过程中不需要的信息。
// ————————————————————————= block 代替代理 =——————————————//
meView .h 文件定义block属性 :
// 个人资料 点击
@property(nonatomic,strong) void (^personInforClick)(void);
meView的 .m 文件中,按钮的点击事件 调用 属性block
-(void)clickNameRightBtn:(UIButton *)sender
{
self.personInforClick();
}
meviewVC .m 初始化meview的同时,初始化属性block
Meview *meview = [[Meview alloc]initWithFrame:[UIScreen mainScreen].bounds];
[meview setPersonInforClick:^{
[self personInforClick];
}];
meviewVC 中的实现相关的功能 [self personInforClick];
#pragam mark - 个人资料点击事件,具体实现,meviewVC.m
-(void)personInforClick{
if ([UserImgName checkLoginState]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您还没有登录,是否跳到登录界面" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",nil];
[alert show];
}else{
PersonInforViewController *personInfor = [[PersonInforViewController alloc]init];
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:personInfor animated:YES];
self.hidesBottomBarWhenPushed = NO;
}
}
// —————————= 友盟分享———=//
无分享数据(分享标题,描述,图片)时,微信仍可以打开客户端分享,QQ打不开客户端
// ———————= 获取 在stroyboard中创建的xib ————————=//
UIStoryboard *storyBoard=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
FillInfoViewController *note=[storyBoard instantiateViewControllerWithIdentifier:@"FillInfoViewController"];
// —————— 预编译 ———
unknown type name 'nsstring'
solution:
#ifdef __OBJC__
#import <UIKit/UIKit.h> //这个是你预编译的文件举例。
#endif
//================ ftp 管理 =========
// =============== 文件操作 ===========
/*
NSString *path = @"~/textFile.ios";
NSString *pathExtension = [path pathExtension];
*/
// 判断本地
/**
BOOL isDir;
[[NSFileManager defaultManager] fileExistsAtPath:@"/Users/fcrj/Desktop/PieChart" isDirectory:&isDir];
if(isDir)//是文件夹
{
}else{
}
*/
// ============== log bug report SYSTEM ============
Message from debugger: The LLDB RPC server has crashed. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.
/// ========= 指令明确 ====== shi ming bi da
//================== 左滑显示多个选项 cell 侧滑多个选项 =========
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewRowAction *action0 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"修改" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// NSLog(@"点击了。。%d",indexPath.row);
// 收回左滑出现的按钮(退出编辑模式)
tableView.editing = NO;
}];
// action0.backgroundColor = [UIColor darkGrayColor];
action0.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backw"]];
UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// NSLog(@"删除。。%d",indexPath.row);
tableView.editing = NO;
}];
UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"删除1" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// NSLog(@"删除1。。%d",indexPath.row);
tableView.editing = NO;
}];
action2.backgroundColor = [UIColor blueColor];
return @[action1, action0,action2];
}
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步