zoukankan      html  css  js  c++  java
  • Foundation

    // —————————————— FOUNDATION框架结构体

            

            // NSRANGE

            // 查找某个字符串在另一个字符串中的范围,若是找不到 length==0 location==NSNotFound==-1

            NSString *str1 = @"hello world! ....";

            NSString *str2 = @"world";

            

            NSRange range = [str1 rangeOfString:str2];

            NSLog(@"position is: %ld, length is : %ld", range.location, range.length);

            

            // CGPoint 表示坐标

            CGPoint point = CGPointMake(100, 100);

            

            // CGSize 表示UI元素的尺寸(宽度、高度) w:100 h:50

            CGSize size = CGSizeMake(100, 50);

            

            // CGRect 表示UI元素的位置及尺寸 x:100 y:100 w:500 h:300

            CGRect r1 = CGRectMake(100, 100, 500, 300);

            

            // 比较两个点是否相同 (x、y)

            BOOL isEqualPoint = CGPointEqualToPoint(CGPointMake(100, 100), CGPointMake(50, 50));

            NSLog(@"p1 isequal p2 ? %i", isEqualPoint);

            

            // 判断某个点是否在区域内

            BOOL containsPoint = CGRectContainsPoint(CGRectMake(100, 100, 500, 100), CGPointMake(120, 130));

            NSLog(@"rect contains point ? %i", containsPoint);

  • 相关阅读:
    python 杂谈
    python: list转字符串
    dataframe
    time模块
    python 调试器
    BAT机器学习面试1000题系列(41-45题)
    join()函数
    value_counts()
    模型评估
    04flask_scripts使用
  • 原文地址:https://www.cnblogs.com/xiangjune/p/4883528.html
Copyright © 2011-2022 走看看