zoukankan      html  css  js  c++  java
  • 【Foundation Frame】Struct

    //
    //  main.m
    //  struct
    //
    //  Created by mac on 14-12-2.
    //  Copyright (c) 2014 mac. All rights reserved.
    //

    #import <Foundation/Foundation.h>

    #pragma mark 基本数据类型----
    void baseType()
    {
       
    //unsigned long  %lu
       
    NSUInteger i;
       
    //long
       
    NSInteger  j;
       
    //double
       
    NSTimeInterval  k;
    }

    #pragma 结构体---------------
    void structType()
    {
       
    //first type
       
    NSRange range = {34,67};
       
    NSLog(@"%lu,%lu",range.location,range.length);
       
    //second type
       
    NSRange range1 = {.location = 43, .length = 76};
       
    NSLog(@"%lu,%lu",range1.location,range1.length);
       
    //third type
       
    NSRange range3 = NSMakeRange(456, 789);
       
    NSLog(@"%lu,%lu",range3.location,range3.length);
       
       
    //example
       
    NSString *str =@"Hello,NSStruct";
       
    NSRange range4 = [str rangeOfString:@"Hello"];
       
    NSLog(@"%lu,%lu",range4.location,range4.length);
       
       
    //point
       
    NSPoint  point = NSMakePoint(0.0, 0.0) ;
       
    //size
       
    NSSize  size  = NSMakeSize(34.2, 123.1);
       
    //rect
       
    NSRect  rect  = NSMakeRect(0.0, 0.0, 234, 231);
       
       
    //CG 开头的结构体
       
    CGPoint point1 = CGPointMake(0.0, 0.0);
       
    CGSize  size1  = CGSizeMake(34.2, 123.1);
       
    CGRect  rect2  = CGRectMake(45.2, 34.2, 40, 60);
      
       
    CGPoint point2 = CGPointZero;
       
    CGSize  size2 = CGSizeZero;
       
    CGRect  rect3 = CGRectZero;
     
    }


    int main(int argc, const char * argv[]) {
       
    @autoreleasepool {
           
           
    structType();
        }
       
    return 0;
    }
  • 相关阅读:
    最大值及下标值
    查找整数
    打印沙漏
    抓老鼠啊~亏了还是赚了?
    币值转换
    秋季学期学习总结
    菜鸟学习Spring——SpringIoC容器基于三种配置的对比
    yanxin8文章归档
    2014——2015总结
    Java入门到精通——调错篇之Spring2.5利用aspect实现AOP时报错: error at ::0 can't find referenced pointcut XXX
  • 原文地址:https://www.cnblogs.com/shujucn/p/7481457.html
Copyright © 2011-2022 走看看