zoukankan      html  css  js  c++  java
  • 小白学开发(iOS)OC_ 经常使用结构体(2015-08-14)

    //

    //  main.m

    //  经常使用结构体

    //

    //  Created by admin on 15/8/13.

    //  Copyright (c) 2015 admin. All rights reserved.

    //


    #import <Foundation/Foundation.h>


    int main(int argc, const char * argv[]) {

        @autoreleasepool {


    //      1. 表示范围:NSRange 结构体

            NSRange range = {4, 5};     // {location, length}   第一种方法定义

            NSRange range1 = NSMakeRange(4, 5); // 另外一种,用法定义

            NSString *strRange = NSStringFromRange(range1);// 将范围转换成字符串

            NSLog(@"strRange: %@", strRange);   // 打印出范围

            

    //      2. 表示大小:NSSize 结构体

            NSSize size = {20, 30};         //  {widthheight}

            NSSize size1 = NSMakeSize(20, 30);

            NSString *strSize = NSStringFromSize(size1);

            NSLog(@"strSize: %@", strSize);

            

    //      3. 表示坐标:NSPoint

            NSPoint point = {0, 10};   // {x, y}

            NSPoint point1 = NSMakePoint(0, 10);

            NSString *strPoint = NSStringFromPoint(point1);

            NSLog(@"strPoint: %@", strPoint);

            

    //      4. 表示一个矩形的位置和大小(经常使用于UI中确定控件的大小和位置)

            NSRect rect = {0, 20, 200, 250};    // {x, y, width, height}

            NSRect rect1 = NSMakeRect(0, 20, 200, 250);

            NSString *strRect = NSStringFromRect(rect1);

            NSLog(@"strRect: %@", strRect);

          

        }

        return 0;

    }


  • 相关阅读:
    Running ASP.NET Applications in Debian and Ubuntu using XSP and Mono
    .net extjs 封装
    ext direct spring
    install ubuntu tweak on ubuntu lts 10.04,this software is created by zhouding
    redis cookbook
    aptana eclipse plugin install on sts
    ubuntu open folderpath on terminal
    ubuntu install pae for the 32bit system 4g limited issue
    EXT Designer 正式版延长使用脚本
    用 Vagrant 快速建立開發環境
  • 原文地址:https://www.cnblogs.com/jhcelue/p/6977771.html
Copyright © 2011-2022 走看看