美文网首页
iOS 掌握

iOS 掌握

作者: 半夜气笛 | 来源:发表于2019-08-25 00:07 被阅读0次

1.其实很简单,直接找到官方的关于 App Icons 和 App launchImage的示例进行对比。另外,如果你的.png图片去掉alpha依然有问题,那就改成.jpg图片吧。不要浪费宝贵的时间。
1.点击按钮振动
//点击按钮振动事件
导入#import <AudioToolbox/AudioToolbox.h>
在按钮点击事件中,加入以下代码
//AudioToolBox.framework下的 点击振动
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

2.字符串的使用
//获取地址
NSString *filePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"zhiKuCaiDesc.txt"];
//获取字符串 读取内容的方式
1.ffilepath转化为字符串
NSString *str = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
2.转化为二进制 二进制转化为字符串
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSString *str=[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
textView.text = str;

3.重新登录的几种方式
1.present 到viewcontroller
MPLoginViewController * loginVC =[[MPLoginViewController alloc]init];
MPNavigationController * nav = [[MPNavigationController alloc]initWithRootViewController:loginVC];
loginVC.isPresentViewController = YES;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
返回的时候 用dismiss
2.[self.navigationController pushViewController:VC animated:NO];

//获取Window当前显示的ViewController

  • (UIViewController)currentViewController{
    //获得当前活动窗口的根视图
    UIViewController
    vc = [UIApplication sharedApplication].keyWindow.rootViewController;
    while (1)
    {
    //根据不同的页面切换方式,逐步取得最上层的viewController
    if ([vc isKindOfClass:[UITabBarController class]]) {
    vc = ((UITabBarController)vc).selectedViewController;
    }
    if ([vc isKindOfClass:[UINavigationController class]]) {
    vc = ((UINavigationController
    )vc).visibleViewController;
    }
    if (vc.presentedViewController) {
    vc = vc.presentedViewController;
    }else{
    break;
    }
    }
    return vc;
    }
  1. if (iOS7) {
    // 声明这张图片用原图(别渲染)
    selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    }
    //防止图片变成蓝色
    3.[IOS/UINavigation]隐藏UINavigationBar的返回文字
    http://blog.csdn.net/zheng_paul/article/details/51206507
    返回首页
    1.遍历所有的自控制器
    for (UIViewController* v in self.navigationController.viewControllers) {
    if ([v isKindOfClass:[BuyVC class]]) {
    [self.navigationController popToViewController:v animated:YES];
    }
    }

2.//获取Window当前显示的ViewController

  • (UIViewController)currentViewController{
    //获得当前活动窗口的根视图
    UIViewController
    vc = [UIApplication sharedApplication].keyWindow.rootViewController;
    while (1)
    {
    //根据不同的页面切换方式,逐步取得最上层的viewController
    if ([vc isKindOfClass:[UITabBarController class]]) {
    vc = ((UITabBarController)vc).selectedViewController;
    }
    if ([vc isKindOfClass:[UINavigationController class]]) {
    vc = ((UINavigationController
    )vc).visibleViewController;
    }
    if (vc.presentedViewController) {
    vc = vc.presentedViewController;
    }else{
    break;
    }
    }
    return vc;
    }

相关文章

  • iOS 性能调优,成为一名合格iOS程序员必须掌握的技能

    iOS 性能调优,成为一名合格iOS程序员必须掌握的技能 iOS 性能调优,成为一名合格iOS程序员必须掌握的技能

  • OC与JS交互

    要掌握iOS与JS交互,首先一定要掌握的就是,iOS的h5容器UIWebView和WKWebView,下面我们就分...

  • iOS 掌握

    1.其实很简单,直接找到官方的关于 App Icons 和 App launchImage的示例进行对比。另外,如...

  • 2017 0313 准备 进阶

    入门级iOS开发者需要掌握的知识清单 一个资深的iOS开发者需要掌握哪些技能? iOS工程师Mac上的必备软件 M...

  • IOS runtime简介

    runtime是什么### 掌握runtime是做好iOS开发,或是深刻掌握Objective C所必需理解的东西...

  • iOS学习技术栈

    iOS学习需要掌握的技术点,以及项目性能优化

  • 关于几篇iOS性能优化的文章

    iOS 性能调优,成为一名合格iOS程序员必须掌握的技能 使用 ASDK 性能调优 - 提升 iOS 界面的渲染性...

  • UI-基础控件

    学习UI两天后基本掌握了一些UI的基本控件用法。先说明一下,我学的是iOS 不是IOS,不是ios,也不是IoS等...

  • CocoaPod 常用命令

    简介 CocoaPods 是 iOS 非常常用的类库管理工具 作为 iOS 程序员,掌握 CocoaPods 的常...

  • iOS 与 JS 交互开发知识总结

    前言 Web 页面中的 JS 与 iOS Native 如何交互是每个 iOS 猿必须掌握的技能。而说到 Nati...

网友评论

      本文标题:iOS 掌握

      本文链接:https://www.haomeiwen.com/subject/tnvcectx.html