美文网首页
软件开发问题集锦

软件开发问题集锦

作者: 半夜气笛 | 来源:发表于2018-03-20 10:15 被阅读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;
    }

相关文章

  • 软件开发问题集锦

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

  • 问题集锦

    公司一 在两个子线程中利用Handler 实现通信 手写冒泡算法 Activity 四种启动模式 Activity...

  • 问题集锦

    (intermediate value)(...) is not a function https://githu...

  • 问题集锦

    1. Release apk打包问题:Lint found fatal errors while assembli...

  • 问题集锦

    一伙人凭借激情凑在一起开店容易,但是想要经营好并非易事。 第一:股东众多、管理混乱且低效。众筹模式少则几十人,多则...

  • 问题集锦

    title: 问题集锦 fastjson 使用 unable to resolve superclass of ...

  • 问题集锦

    OC、C++、Swift混编易遇到如下问题: Use of '@import' when C++ modules ...

  • 问题集锦

    Nodejs连接数据库,用node 运行查询数据成功。用react引用该文件,则报错,createconnect ...

  • 问题集锦

    服务器环境由被破坏了,又重新装下tensorflow 1)miniconda安装后不能使用conda 命令,此时需...

  • 问题集锦

    makefile 中 .PYONY 的目的是什么默认情况下,Makefile 目标是「文件目标」- 它们用于从其他...

网友评论

      本文标题:软件开发问题集锦

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