• iOS开发各种小知识


    1.父视图的透明度属性会传递给子视图
    2.iPad可以运行iPhone的程序 iPhone不可以运行iPad的程序
    3. //判断是iPad 还是iPhone
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            NSLog(@"iPad");
        } else {
            NSLog(@"iPhone");
        }
       
     4.   //判断系统的版本号
        if ([[UIDevice currentDevice].systemVersion floatValue] > 7.0) {
            NSLog(@"%@", [UIDevice currentDevice].systemName);
        }
    5 self 在+方法中指类名  在-方法中指类的对象
     

    1.isEqual不知道为什么不可以判断一个对象是否为某个类

    例如  

        if([[[array1 objectAtIndex:0] class] isEqualTo:[NSString class]])

        {

            NSLog(@"nsstring类型");

        }

    这个方法是错误的

     

     

     

    2.在模拟登录注册时候发现的疑难杂症

    为什么在程序中使用了gets()函数获取字符产  ,就不可以用nslog函数打印了呢。❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓

    那是因为定义字符串的时候不要用指针  要用数组 

    例如  char *str; 

        char str[100]

     

     

    3.⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠

    注意   要增加元素  那么必元素初始化   不然增加不了   

    例如     NSMutableArray *array = [NSMutableArray arrayWithCapacity:0];

            NSMutableArray *array nil

     

    4.数据库使用参数sql语句的时候  

    不能调用exec函数   要用step函数   切记3⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠

     

    5.修改barbuttonitem的外观  这个方法设置一次全部都会变   全局设置

    UIBarButtonItem *appearanceBarButton = [UIBarButtonItem appearance];

        NSMutableDictionary *dict = [NSMutableDictionary dictionary];

        dict[NSForegroundColorAttributeName] = [UIColor redColor];

        [appearanceBarButton setTitleTextAttributes:dict forState:UIControlStateNormal];

     

    6//第一次使用类的时候调用

    + (void)initialize

    {

        if (self == [self class]) {

            

        }

    }

     

    7//设置键盘的辅助视图

        UITextField *textField = [[UITextField alloc] init];

        textField.inputAccessoryView = [[UIView alloc] init];

     

    8//图片拉伸

        UIImage *newImage = [image resizableImageWithCapInsets:UIEdgeInsetsMake(15, 22, 15, 22)];

     

    9    btn.adjustsImageWhenHighlighted = NO;//表示button高亮状态下  图片不会变颜色

     

    10.NSClassFromString(<#NSString *aClassName#>)//根据字符串转换为类名

     

    11.tableViewController 貌似可以实现自动刷新的功能    不是很确定 还有待确认

    12 开两个模拟器的命令 

    cd /Applications/Xcode.app/Contents/Developer/Applications/

    open -n iOS Simulator.app/

     

  • 相关阅读:
    vant ui 在vue中的安装和使用
    vue-element-admin完整项目实例
    关于Vue中main.js,App.vue,index.html之间关系进行总结
    vue 集成 element ui
    springboot写入数据库汉字变问号???
    import declarations are not supported
    基于Idea从零搭建一个最简单的vue项目
    idea中执行“npm”命令,提示node 不是内部或外部命令,也不是可运行的程序
    Intellij IDEA 中如何 给Maven添加依赖
    圆圈中最后剩下的数字
  • 原文地址:https://www.cnblogs.com/bing-ge/p/4615927.html
Copyright © 2020-2023  润新知